-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_permgen.cpp
More file actions
39 lines (32 loc) · 906 Bytes
/
Copy pathtest_permgen.cpp
File metadata and controls
39 lines (32 loc) · 906 Bytes
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
#include <cppunit/extensions/HelperMacros.h>
#include "permgen.h"
class PermGen_test : public CppUnit::TestFixture {
public:
void test_generate()
{
std::vector<Key> keys;
{
Generator gen(3456789012);
Key state = 0;
for(size_t i = 0; i < 10; ++i)
{
state = gen.generate(state);
CPPUNIT_ASSERT(state <= 3456789012);
keys.push_back(state);
}
}
{
Generator gen2(3456789012);
Key state = keys[4];
for(size_t i = 0; i < 5; ++i)
{
state = gen2.generate(state);
CPPUNIT_ASSERT(state == keys[5+i]);
}
}
}
CPPUNIT_TEST_SUITE(PermGen_test);
CPPUNIT_TEST(test_generate);
CPPUNIT_TEST_SUITE_END();
};
CPPUNIT_TEST_SUITE_REGISTRATION(PermGen_test);