summaryrefslogtreecommitdiff
path: root/src/common/intern-pool_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/intern-pool_test.cpp')
-rw-r--r--src/common/intern-pool_test.cpp18
1 files changed, 18 insertions, 0 deletions
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 <gtest/gtest.h>
+
+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));
+}