From 3b98f3439e33b15bba2036c402f9925340fdb2b9 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sat, 29 Jun 2013 23:23:43 -0700 Subject: Poison std::string and use the various string classes --- src/common/intern-pool_test.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/common/intern-pool_test.cpp (limited to 'src/common/intern-pool_test.cpp') diff --git a/src/common/intern-pool_test.cpp b/src/common/intern-pool_test.cpp new file mode 100644 index 0000000..3bbca7b --- /dev/null +++ b/src/common/intern-pool_test.cpp @@ -0,0 +1,18 @@ +#include "intern-pool.hpp" + +#include + +TEST(InternPool, whydoesthisalwaysneedasecondname) +{ + InternPool p; + EXPECT_EQ(0, p.size()); + EXPECT_EQ(0, p.intern("hello")); + EXPECT_EQ(0, p.intern("hello")); + EXPECT_EQ(1, p.size()); + EXPECT_EQ(1, p.intern("world")); + EXPECT_EQ(0, p.intern("hello")); + EXPECT_EQ(1, p.intern("world")); + EXPECT_EQ(2, p.size()); + EXPECT_EQ("hello", p.outtern(0)); + EXPECT_EQ("world", p.outtern(1)); +} -- cgit v1.2.3-60-g2f50