ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/test/utils/NextCombinationTestCase.cpp
(Generate patch)

Comparing trunk/OOPSE-4/test/utils/NextCombinationTestCase.cpp (file contents):
Revision 1673 by tim, Thu Oct 28 15:42:17 2004 UTC vs.
Revision 1674 by tim, Thu Oct 28 19:06:59 2004 UTC

# Line 5 | Line 5 | void NextCombinationTestCase::testNextCombination() {
5   // Registers the fixture into the 'registry'
6   CPPUNIT_TEST_SUITE_REGISTRATION( NextCombinationTestCase);
7   void NextCombinationTestCase::testNextCombination() {
8 <    std::vector<double> dv;
9 <    std::vector<std::vector<double>::iterator> ic;
8 >    std::vector<int> iv;
9 >    std::vector<std::vector<int>::iterator> ic;
10 >    std::vector<std::vector<int>::iterator>::iterator i;
11 >    iv.push_back(0);
12 >    iv.push_back(1);
13 >    iv.push_back(4);
14 >    std::cout << std::endl;
15  
16 <    while (next_combination(ic, dv.begin(), dv.end())) {
17 <
18 <        
16 >    std::vector<std::vector<int> > results;
17 >    while (next_combination(ic, iv.begin(), iv.end())) {
18 >      std::vector<int> v;  
19 >      for(i = ic.begin();i != ic.end(); ++i) {
20 >         v.push_back(**i);  
21 >      }      
22 >      results.push_back(v);  
23      }
24 +
25 +    CPPUNIT_ASSERT(results.size() == 7);
26 +    CPPUNIT_ASSERT(results[0][0] == 0  && results[0].size() == 1);
27 +    CPPUNIT_ASSERT(results[1][0] == 1 && results[1].size() == 1);
28 +    CPPUNIT_ASSERT(results[2][0] == 4  && results[2].size() == 1);
29 +    CPPUNIT_ASSERT(results[3][0] == 0  && results[3][1] == 1  && results[3].size() == 2);
30 +    CPPUNIT_ASSERT(results[4][0] == 0 && results[4][1] == 4 && results[4].size() == 2);
31 +    CPPUNIT_ASSERT(results[5][0] == 1 && results[5][1] == 4  && results[5].size() == 2);
32 +    CPPUNIT_ASSERT(results[6][0] == 0  && results[6][1] == 1 && results[6][2] == 4 && results[6].size() == 3);
33 +    
34   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines