summaryrefslogtreecommitdiff
path: root/extractor/data_array_test.cc
diff options
context:
space:
mode:
authorPaul Baltescu <pauldb89@gmail.com>2013-11-26 16:08:41 +0000
committerPaul Baltescu <pauldb89@gmail.com>2013-11-26 16:17:45 +0000
commit7b7167248cd605c9f5bd91b3c87e2826d2336a9f (patch)
tree608c4cf0435225b44a9d34d8f6a7d75cd841ac5a /extractor/data_array_test.cc
parent3ece9d5cf8c58edd55da35ac96f1a5869d7d6608 (diff)
parent0d1f0af81ad2a368bc3216451a87111be8b9f6f5 (diff)
Merge branch 'master' of github.com:pauldb89/cdec
Diffstat (limited to 'extractor/data_array_test.cc')
-rw-r--r--extractor/data_array_test.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/extractor/data_array_test.cc b/extractor/data_array_test.cc
index b6b56561..99f79d91 100644
--- a/extractor/data_array_test.cc
+++ b/extractor/data_array_test.cc
@@ -56,6 +56,18 @@ TEST_F(DataArrayTest, TestGetData) {
}
}
+TEST_F(DataArrayTest, TestSubstrings) {
+ vector<int> expected_word_ids = {3, 4, 5};
+ vector<string> expected_words = {"are", "mere", "."};
+ EXPECT_EQ(expected_word_ids, source_data.GetWordIds(1, 3));
+ EXPECT_EQ(expected_words, source_data.GetWords(1, 3));
+
+ expected_word_ids = {7, 8};
+ expected_words = {"a", "lot"};
+ EXPECT_EQ(expected_word_ids, target_data.GetWordIds(7, 2));
+ EXPECT_EQ(expected_words, target_data.GetWords(7, 2));
+}
+
TEST_F(DataArrayTest, TestVocabulary) {
EXPECT_EQ(9, source_data.GetVocabularySize());
EXPECT_EQ(4, source_data.GetWordId("mere"));