blob: e464f2f10da48bc497565a3a04b727751ddace16 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#define BOOST_TEST_MODULE test_lib
#include "test-helpers.hpp"
#include <boost/test/data/test_case.hpp>
#include <boost/test/unit_test.hpp>
#include <GL/glew.h>
#include <glArrays.h>
#include <set>
std::set<GLuint> active;
void
generator(GLsizei n, GLuint * out)
{
static GLuint next {1};
while (n--) {
active.insert(next);
*out++ = next++;
}
}
void
deleter(GLsizei n, GLuint * in)
{
BOOST_CHECK(std::all_of(in, in + n, [](GLuint id) {
return active.erase(id) > 0;
}));
}
using TestArray = glArrays<5, &generator, &deleter>;
BOOST_AUTO_TEST_CASE(generate_and_delete)
{
{
TestArray a;
}
BOOST_CHECK(active.empty());
}
BOOST_AUTO_TEST_CASE(generate_move_and_delete)
{
{
TestArray a;
BOOST_CHECK_EQUAL(TestArray::size, active.size());
TestArray b {std::move(a)};
BOOST_CHECK_EQUAL(TestArray::size, active.size());
}
BOOST_CHECK(active.empty());
}
|