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
|
#define BOOST_TEST_MODULE pack
#include <boost/test/data/test_case.hpp>
#include <boost/test/unit_test.hpp>
#include "pack.h"
#include <vector>
using IntegerVectorPack = pack<int, std::vector>;
BOOST_FIXTURE_TEST_SUITE(pint, IntegerVectorPack)
BOOST_AUTO_TEST_CASE(basics)
{
BOOST_CHECK_EQUAL(size(), 0);
BOOST_CHECK_NO_THROW(emplace(1));
BOOST_CHECK_NO_THROW(emplace(2));
BOOST_CHECK_NO_THROW(emplace(3));
BOOST_CHECK_NO_THROW(emplace(4));
BOOST_CHECK_EQUAL(size(), 4);
{
std::array expected1 {1, 2, 3, 4};
BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected1.begin(), expected1.end());
}
BOOST_CHECK_NO_THROW(erase(begin() + 1));
BOOST_CHECK_EQUAL(size(), 3);
{
std::array expected1 {1, 4, 3};
BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected1.begin(), expected1.end());
}
BOOST_CHECK_NO_THROW(erase(--end()));
BOOST_CHECK_EQUAL(size(), 2);
{
std::array expected1 {1, 4};
BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected1.begin(), expected1.end());
}
}
BOOST_AUTO_TEST_SUITE_END()
|