summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-07-24 19:51:52 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-07-24 19:54:18 (GMT)
commit545f20b9051caad8d0223bd332a094c2ffbe8435 (patch)
tree03e7cff7c353436f44c92b29bd4390288c5242f1 /SwifTools/UnitTest
parent649b6f713a48e1b65b3032e15326269d7fec3d27 (diff)
downloadswift-545f20b9051caad8d0223bd332a094c2ffbe8435.zip
swift-545f20b9051caad8d0223bd332a094c2ffbe8435.tar.bz2
Improvements and further testing to tab completion.
Resolves: #506 Resolves: #498
Diffstat (limited to 'SwifTools/UnitTest')
-rw-r--r--SwifTools/UnitTest/TabCompleteTest.cpp141
1 files changed, 127 insertions, 14 deletions
diff --git a/SwifTools/UnitTest/TabCompleteTest.cpp b/SwifTools/UnitTest/TabCompleteTest.cpp
index 4d152f6..b7b643f 100644
--- a/SwifTools/UnitTest/TabCompleteTest.cpp
+++ b/SwifTools/UnitTest/TabCompleteTest.cpp
@@ -20,6 +20,7 @@ class TabCompleteTest : public CppUnit::TestFixture {
CPPUNIT_TEST(testChangeMatch);
CPPUNIT_TEST(testRemoveDuringComplete);
CPPUNIT_TEST(testAddDuringComplete);
+ CPPUNIT_TEST(testSwiftRoomSample);
CPPUNIT_TEST_SUITE_END();
public:
@@ -71,14 +72,14 @@ public:
completer_.addWord(long2);
completer_.addWord("Bleh");
CPPUNIT_ASSERT_EQUAL(
- long1,
- completer_.completeWord(short1));
- CPPUNIT_ASSERT_EQUAL(
long2,
- completer_.completeWord(long1));
+ completer_.completeWord(short1));
CPPUNIT_ASSERT_EQUAL(
long1,
completer_.completeWord(long2));
+ CPPUNIT_ASSERT_EQUAL(
+ long2,
+ completer_.completeWord(long1));
}
void testChangeMatch() {
@@ -113,15 +114,15 @@ public:
completer_.addWord(long2);
completer_.addWord("Bleh");
CPPUNIT_ASSERT_EQUAL(
- long1,
- completer_.completeWord(short1));
- completer_.removeWord(long1);
- CPPUNIT_ASSERT_EQUAL(
long2,
- completer_.completeWord(long1));
+ completer_.completeWord(short1));
+ completer_.removeWord(long2);
CPPUNIT_ASSERT_EQUAL(
- long2,
+ long1,
completer_.completeWord(long2));
+ CPPUNIT_ASSERT_EQUAL(
+ long1,
+ completer_.completeWord(long1));
}
void testAddDuringComplete() {
@@ -134,17 +135,129 @@ public:
completer_.addWord(long2);
completer_.addWord("Bleh");
CPPUNIT_ASSERT_EQUAL(
- long1,
+ long2,
completer_.completeWord(short1));
completer_.addWord(long3);
CPPUNIT_ASSERT_EQUAL(
- long2,
- completer_.completeWord(long1));
+ long1,
+ completer_.completeWord(long2));
CPPUNIT_ASSERT_EQUAL(
long3,
- completer_.completeWord(long2));
+ completer_.completeWord(long1));
+ }
+
+ void testSwiftRoomSample() {
+ String t("t");
+ String Anpan("Anpan");
+ String cdubouloz("cdubouloz");
+ String Tobias("Tobias");
+ String Zash("Zash");
+ String lastsky("lastsky");
+ String Steve("Steve Kille");
+ String Flo("Flo");
+ String Test("Test");
+ String test("test");
+ completer_.addWord(Anpan);
+ completer_.addWord(cdubouloz);
+ completer_.addWord(Tobias);
+ completer_.addWord(lastsky);
+ completer_.addWord(Steve);
+ completer_.addWord(Flo);
+ completer_.addWord(Zash);
+
+ CPPUNIT_ASSERT_EQUAL(
+ Tobias,
+ completer_.completeWord(t));
+ CPPUNIT_ASSERT_EQUAL(
+ Tobias,
+ completer_.completeWord(Tobias));
+
+ completer_.addWord(Test);
+
+ CPPUNIT_ASSERT_EQUAL(
+ Test,
+ completer_.completeWord(t));
+ CPPUNIT_ASSERT_EQUAL(
+ Tobias,
+ completer_.completeWord(Test));
+ CPPUNIT_ASSERT_EQUAL(
+ Test,
+ completer_.completeWord(Tobias));
+ CPPUNIT_ASSERT_EQUAL(
+ Tobias,
+ completer_.completeWord(Test));
+
+ completer_.addWord(Zash);
+ completer_.addWord(Zash);
+ completer_.addWord(Zash);
+ completer_.addWord(Zash);
+
+ completer_.removeWord(Test);
+
+ CPPUNIT_ASSERT_EQUAL(
+ Tobias,
+ completer_.completeWord(t));
+ CPPUNIT_ASSERT_EQUAL(
+ Tobias,
+ completer_.completeWord(Tobias));
+
+ completer_.addWord(test);
+
+ completer_.addWord(Zash);
+ completer_.addWord(Zash);
+ completer_.addWord(Zash);
+ completer_.addWord(Zash);
+
+
+ CPPUNIT_ASSERT_EQUAL(
+ test,
+ completer_.completeWord(t));
+ CPPUNIT_ASSERT_EQUAL(
+ Tobias,
+ completer_.completeWord(test));
+ CPPUNIT_ASSERT_EQUAL(
+ test,
+ completer_.completeWord(Tobias));
+ CPPUNIT_ASSERT_EQUAL(
+ Tobias,
+ completer_.completeWord(test));
+
+ completer_.removeWord(test);
+
+ CPPUNIT_ASSERT_EQUAL(
+ Tobias,
+ completer_.completeWord(t));
+ CPPUNIT_ASSERT_EQUAL(
+ Tobias,
+ completer_.completeWord(Tobias));
+
+ completer_.removeWord(Tobias);
+ CPPUNIT_ASSERT_EQUAL(
+ t,
+ completer_.completeWord(t));
+ CPPUNIT_ASSERT_EQUAL(
+ t,
+ completer_.completeWord(t));
+ CPPUNIT_ASSERT_EQUAL(
+ t,
+ completer_.completeWord(t));
+ CPPUNIT_ASSERT_EQUAL(
+ t,
+ completer_.completeWord(t));
+
+ completer_.addWord(Tobias);
+
+ CPPUNIT_ASSERT_EQUAL(
+ Tobias,
+ completer_.completeWord(t));
+ CPPUNIT_ASSERT_EQUAL(
+ Tobias,
+ completer_.completeWord(Tobias));
+
}
+
+
private:
TabComplete completer_;
};