diff options
Diffstat (limited to 'src/generic/intern-pool_test.cpp')
-rw-r--r-- | src/generic/intern-pool_test.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/generic/intern-pool_test.cpp b/src/generic/intern-pool_test.cpp new file mode 100644 index 0000000..bf17b67 --- /dev/null +++ b/src/generic/intern-pool_test.cpp @@ -0,0 +1,20 @@ +#include "intern-pool.hpp" + +#include <gtest/gtest.h> + +#include "../strings/base.hpp" + +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)); +} |