diff -r 31a43d94cc26 -r 8e3ae153e2c9 test/Dictionary_test.cpp --- a/test/Dictionary_test.cpp Sun Sep 20 15:14:12 2009 -0700 +++ b/test/Dictionary_test.cpp Thu Sep 24 10:28:50 2009 -0700 @@ -32,6 +32,26 @@ return *sDict; } +TEST(Dictionary,AddRemove) { + HashDictionary dict; + EXPECT_EQ(0, dict.count()); + dict.put("key 1", "value 1"); + EXPECT_EQ(1, dict.count()); + dict.put("key 2", "value 2"); + EXPECT_EQ(2, dict.count()); + dict.put("key 3", "value 3"); + EXPECT_TRUE(dict.get("key 1").equals("value 1")); + EXPECT_TRUE(dict.get("key 2").equals("value 2")); + EXPECT_TRUE(dict.get("key 3").equals("value 3")); + EXPECT_TRUE(!dict.get("key 4")); + + EXPECT_TRUE(dict.remove("key 2")); + EXPECT_EQ(2, dict.count()); + EXPECT_TRUE(dict.get("key 1").equals("value 1")); + EXPECT_TRUE(!dict.get("key 2")); + EXPECT_TRUE(dict.get("key 3").equals("value 3")); +} + TEST(Dictionary,GetAll) { const Dictionary &dict = getDict(); EXPECT_EQ( sNWords , dict.count() );