4 |
|
|
5 |
|
// Registers the fixture into the 'registry' |
6 |
|
CPPUNIT_TEST_SUITE_REGISTRATION( NextCombinationTestCase); |
7 |
+ |
|
8 |
+ |
|
9 |
|
void NextCombinationTestCase::testNextCombination() { |
10 |
|
std::vector<int> iv; |
11 |
|
std::vector<std::vector<int>::iterator> ic; |
32 |
|
CPPUNIT_ASSERT(results[4][0] == 0 && results[4][1] == 4 && results[4].size() == 2); |
33 |
|
CPPUNIT_ASSERT(results[5][0] == 1 && results[5][1] == 4 && results[5].size() == 2); |
34 |
|
CPPUNIT_ASSERT(results[6][0] == 0 && results[6][1] == 1 && results[6][2] == 4 && results[6].size() == 3); |
35 |
+ |
|
36 |
+ |
std::vector<std::string> sv; |
37 |
+ |
std::vector<std::vector<std::string>::iterator> sic; |
38 |
+ |
std::vector<std::vector<std::string>::iterator>::iterator j; |
39 |
+ |
std::vector<std::vector<std::string> > resultStrings; |
40 |
+ |
std::vector<std::string> resultString; |
41 |
+ |
sv.push_back("H"); |
42 |
+ |
sv.push_back("C"); |
43 |
+ |
sv.push_back("N"); |
44 |
+ |
|
45 |
+ |
while (replaceWithWildCard(sic, sv, resultString)) { |
46 |
+ |
resultStrings.push_back(resultString); |
47 |
+ |
} |
48 |
+ |
|
49 |
+ |
CPPUNIT_ASSERT(resultStrings.size() == 7); |
50 |
+ |
CPPUNIT_ASSERT(resultStrings[0][0] == "H" && resultStrings[0][1] == "X" && resultStrings[0][2] == "X" && resultStrings[0].size() == 3); |
51 |
+ |
CPPUNIT_ASSERT(resultStrings[1][0] == "X" && resultStrings[1][1] == "C" && resultStrings[1][2] == "X" && resultStrings[1].size() == 3); |
52 |
+ |
CPPUNIT_ASSERT(resultStrings[2][0] == "X" && resultStrings[2][1] == "X" && resultStrings[2][2] == "N" && resultStrings[2].size() == 3); |
53 |
+ |
CPPUNIT_ASSERT(resultStrings[3][0] == "H" && resultStrings[3][1] == "C" && resultStrings[3][2] == "X" && resultStrings[3].size() == 3); |
54 |
+ |
CPPUNIT_ASSERT(resultStrings[4][0] == "H" && resultStrings[4][1] == "X" && resultStrings[4][2] == "N" && resultStrings[4].size() == 3); |
55 |
+ |
CPPUNIT_ASSERT(resultStrings[5][0] == "X" && resultStrings[5][1] == "C" && resultStrings[5][2] == "N" && resultStrings[5].size() == 3); |
56 |
+ |
CPPUNIT_ASSERT(resultStrings[6][0] == "H" && resultStrings[6][1] == "C" && resultStrings[6][2] == "N" && resultStrings[6].size() == 3); |
57 |
|
|
58 |
|
} |
59 |
+ |
|