diff options
Diffstat (limited to 'test/gtest/stringify.cpp')
-rw-r--r-- | test/gtest/stringify.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/gtest/stringify.cpp b/test/gtest/stringify.cpp index fac745be9..01d7ad7af 100644 --- a/test/gtest/stringify.cpp +++ b/test/gtest/stringify.cpp @@ -261,3 +261,20 @@ TEST_F(StringifyTest, Substrings) { // 7, 6 appears at idx 11 and again at 24 SuffixTree::RepeatedSubstring{2u, (std::vector<unsigned>{11, 24})}})); } + +TEST_F(StringifyTest, DedupeSubstrings) { + Module wasm; + parseWast(wasm, dupModuleText); + auto hashString = hashStringifyModule(&wasm); + std::vector<SuffixTree::RepeatedSubstring> substrings = + repeatSubstrings(hashString); + auto result = StringifyProcessor::dedupe(substrings); + + EXPECT_EQ( + result, + (std::vector<SuffixTree::RepeatedSubstring>{ + // 5, 6, 7, 6 appears at idx 9 and again at 22 + SuffixTree::RepeatedSubstring{4u, (std::vector<unsigned>{9, 22})}, + // 10, 11, 6 appears at idx 18 and again at 27 + SuffixTree::RepeatedSubstring{3u, (std::vector<unsigned>{18, 27})}})); +} |