blob: 3bbca7ba9a2e821c01deef8df1b40b30d021bf78 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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));
}
|