--- trunk/test/utils/NextCombinationTestCase.cpp 2004/10/28 19:06:59 181 +++ trunk/test/utils/NextCombinationTestCase.cpp 2004/11/24 19:49:33 227 @@ -4,6 +4,8 @@ CPPUNIT_TEST_SUITE_REGISTRATION( NextCombinationTestCa // Registers the fixture into the 'registry' CPPUNIT_TEST_SUITE_REGISTRATION( NextCombinationTestCase); + + void NextCombinationTestCase::testNextCombination() { std::vector iv; std::vector::iterator> ic; @@ -30,5 +32,28 @@ void NextCombinationTestCase::testNextCombination() { CPPUNIT_ASSERT(results[4][0] == 0 && results[4][1] == 4 && results[4].size() == 2); CPPUNIT_ASSERT(results[5][0] == 1 && results[5][1] == 4 && results[5].size() == 2); CPPUNIT_ASSERT(results[6][0] == 0 && results[6][1] == 1 && results[6][2] == 4 && results[6].size() == 3); + + std::vector sv; + std::vector::iterator> sic; + std::vector::iterator>::iterator j; + std::vector > resultStrings; + std::vector resultString; + sv.push_back("H"); + sv.push_back("C"); + sv.push_back("N"); + + while (replaceWithWildCard(sic, sv, resultString)) { + resultStrings.push_back(resultString); + } + + CPPUNIT_ASSERT(resultStrings.size() == 7); + CPPUNIT_ASSERT(resultStrings[0][0] == "H" && resultStrings[0][1] == "X" && resultStrings[0][2] == "X" && resultStrings[0].size() == 3); + CPPUNIT_ASSERT(resultStrings[1][0] == "X" && resultStrings[1][1] == "C" && resultStrings[1][2] == "X" && resultStrings[1].size() == 3); + CPPUNIT_ASSERT(resultStrings[2][0] == "X" && resultStrings[2][1] == "X" && resultStrings[2][2] == "N" && resultStrings[2].size() == 3); + CPPUNIT_ASSERT(resultStrings[3][0] == "H" && resultStrings[3][1] == "C" && resultStrings[3][2] == "X" && resultStrings[3].size() == 3); + CPPUNIT_ASSERT(resultStrings[4][0] == "H" && resultStrings[4][1] == "X" && resultStrings[4][2] == "N" && resultStrings[4].size() == 3); + CPPUNIT_ASSERT(resultStrings[5][0] == "X" && resultStrings[5][1] == "C" && resultStrings[5][2] == "N" && resultStrings[5].size() == 3); + CPPUNIT_ASSERT(resultStrings[6][0] == "H" && resultStrings[6][1] == "C" && resultStrings[6][2] == "N" && resultStrings[6].size() == 3); } +