summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-07-04 11:04:13 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-07-04 12:35:27 (GMT)
commit558e5eb1b4b7d7de5ef291c173ed6ac012f23854 (patch)
tree33aee26438ca0ac1de7bcc4817e932bd47445fa4 /Swift/Controllers/Roster/UnitTest
parentf2bbeeae4f277ab02edee8fb39cbd397931595e2 (diff)
downloadswift-558e5eb1b4b7d7de5ef291c173ed6ac012f23854.zip
swift-558e5eb1b4b7d7de5ef291c173ed6ac012f23854.tar.bz2
Fixed TableRoster bugs.
Diffstat (limited to 'Swift/Controllers/Roster/UnitTest')
-rw-r--r--Swift/Controllers/Roster/UnitTest/LeastCommonSubsequenceTest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/Swift/Controllers/Roster/UnitTest/LeastCommonSubsequenceTest.cpp b/Swift/Controllers/Roster/UnitTest/LeastCommonSubsequenceTest.cpp
index 97b5406..3acab12 100644
--- a/Swift/Controllers/Roster/UnitTest/LeastCommonSubsequenceTest.cpp
+++ b/Swift/Controllers/Roster/UnitTest/LeastCommonSubsequenceTest.cpp
@@ -45,6 +45,7 @@ class LeastCommonSubsequenceTest : public CppUnit::TestFixture {
CPPUNIT_TEST(testComputeLeastCommonSubsequenceMatrix_NoCommonSequence);
CPPUNIT_TEST(testComputeLeastCommonSubsequenceMatrix_SameSequences);
CPPUNIT_TEST(testComputeIndexDiff_1);
+ CPPUNIT_TEST(testComputeIndexDiff_2);
CPPUNIT_TEST(testComputeIndexDiff_Sequence1Empty);
CPPUNIT_TEST(testComputeIndexDiff_Sequence2Empty);
CPPUNIT_TEST(testComputeIndexDiff_BothSequencesEmpty);
@@ -181,6 +182,23 @@ class LeastCommonSubsequenceTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(expectedInserts, inserts);
}
+ void testComputeIndexDiff_2() {
+ std::vector<char> x = boost::assign::list_of('x')('y');
+ std::vector<char> y = boost::assign::list_of('x');
+
+ std::vector<size_t> updates;
+ std::vector<size_t> postUpdates;
+ std::vector<size_t> removes;
+ std::vector<size_t> inserts;
+ computeIndexDiff<char, std::equal_to<char>, IsBOrC >(x, y, updates, postUpdates, removes, inserts);
+
+ std::vector<size_t> expectedRemoves = boost::assign::list_of(1);
+ CPPUNIT_ASSERT(updates.empty());
+ CPPUNIT_ASSERT(postUpdates.empty());
+ CPPUNIT_ASSERT(inserts.empty());
+ CPPUNIT_ASSERT_EQUAL(expectedRemoves, removes);
+ }
+
void testComputeIndexDiff_Sequence1Empty() {
std::vector<char> x;
std::vector<char> y = boost::assign::list_of('a')('b')('c');