summaryrefslogtreecommitdiff
path: root/decoder/dict_test.cc
blob: 5c5d84f0097102f254a4772ae74abbaa8d76eaf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "dict.h"

#include <gtest/gtest.h>
#include <cassert>

class DTest : public testing::Test {
 public:
  DTest() {}
 protected:
  virtual void SetUp() { }
  virtual void TearDown() { }
};

TEST_F(DTest, Convert) {
  Dict d;
  WordID a = d.Convert("foo");
  WordID b = d.Convert("bar");
  std::string x = "foo";
  WordID c = d.Convert(x);
  EXPECT_NE(a, b);
  EXPECT_EQ(a, c);
  EXPECT_EQ(d.Convert(a), "foo");
  EXPECT_EQ(d.Convert(b), "bar");
}

int main(int argc, char** argv) {
  testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}