X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=src%2Ftest%2Fgenealgorithmstest.cpp;h=3f57e0fa3e47a246c02a557e7b0fbeea6996bc98;hb=6724d50f2d36dccd383d95d36f7fe328b2692bc0;hp=2b9ae79bfc89dbac994081a753ddc04feb6d0b37;hpb=6be4116d6211ac4ba4c68dc2ab28f1bc5d77068e;p=germs.git diff --git a/src/test/genealgorithmstest.cpp b/src/test/genealgorithmstest.cpp index 2b9ae79..3f57e0f 100644 --- a/src/test/genealgorithmstest.cpp +++ b/src/test/genealgorithmstest.cpp @@ -23,6 +23,7 @@ class TESTNAME : public CPPUNIT_NS::TestFixture CPPUNIT_TEST( testRobinsonSchensted ); CPPUNIT_TEST( testLongestSequences ); CPPUNIT_TEST( testFindIntervals ); + CPPUNIT_TEST( testFindIntervalsAtPoints ); CPPUNIT_TEST( testCountCycles ); CPPUNIT_TEST_SUITE_END(); @@ -88,11 +89,30 @@ protected: CPPUNIT_ASSERT(go10 == v[0]); CPPUNIT_ASSERT(go12 == v[2]); - GeneOrder go2(_validPerm2.begin(),_validPerm2.end()); + GeneOrder go2(_validPerm3.begin(),_validPerm3.end()); + v = findIntervals(go2); + CPPUNIT_ASSERT_EQUAL(16ul,v.size()); + Interval go20(1,2); + Interval go22(4,2); + CPPUNIT_ASSERT(go20 == v[0]); + CPPUNIT_ASSERT(go22 == v[2]); + } + void testFindIntervalsAtPoints (){ + GeneOrder go(_validPerm.begin(),_validPerm.end()); + vector v = findIntervals(go); + v = findIntervalsAtPoints(v); + CPPUNIT_ASSERT_EQUAL(4ul,v.size()); + Interval go10(0,0); + Interval go12(2,2); + CPPUNIT_ASSERT(go10 == v[0]); + CPPUNIT_ASSERT(go12 == v[2]); + + GeneOrder go2(_validPerm3.begin(),_validPerm3.end()); v = findIntervals(go2); - CPPUNIT_ASSERT_EQUAL(9ul,v.size()); - Interval go20(1,3); - Interval go22(1,4); + v = findIntervalsAtPoints(v); + CPPUNIT_ASSERT_EQUAL(16ul,v.size()); + Interval go20(0,3); + Interval go22(1,1); CPPUNIT_ASSERT(go20 == v[0]); CPPUNIT_ASSERT(go22 == v[2]); }