summaryrefslogtreecommitdiffstats
path: root/test/src/test-trie.cpp
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2016-05-12 13:12:33 (GMT)
committerStefan Radomski <github@mintwerk.de>2016-05-12 13:12:33 (GMT)
commitb62e7979600feee23dc7cdb61042a8fc7673122b (patch)
treef7351372f37979dd2d048e0b68a16a4cd3b2aadb /test/src/test-trie.cpp
parent1b11b310be61e51b3ac5ebb83f7c8a33aef3d6e8 (diff)
downloaduscxml-b62e7979600feee23dc7cdb61042a8fc7673122b.zip
uscxml-b62e7979600feee23dc7cdb61042a8fc7673122b.tar.gz
uscxml-b62e7979600feee23dc7cdb61042a8fc7673122b.tar.bz2
Major Refactoring v2.0
Diffstat (limited to 'test/src/test-trie.cpp')
-rw-r--r--test/src/test-trie.cpp92
1 files changed, 0 insertions, 92 deletions
diff --git a/test/src/test-trie.cpp b/test/src/test-trie.cpp
deleted file mode 100644
index 8c7ab15..0000000
--- a/test/src/test-trie.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-#include "uscxml/util/Trie.h"
-#include <iostream>
-#include <assert.h>
-
-using namespace uscxml;
-
-int main(int argc, char** argv) {
- {
- Trie trie;
- int nrTokens = 0;
- size_t offset = 0;
- std::string word = "this is to be tokenized";
- std::string token;
- while((offset = trie.getNextToken(word, offset, token)) != std::string::npos) {
- std::cout << "\"" << token << "\" ";
- nrTokens++;
- }
- std::cout << std::endl;
- assert(nrTokens == word.length());
- }
-
- {
- Trie trie(" ");
- int nrTokens = 0;
- size_t offset = 0;
- std::string word = "this is to be tokenized";
- std::string token;
- while(offset = trie.getNextToken(word, offset, token), token.length() > 0) {
- std::cout << "\"" << token << "\" ";
- nrTokens++;
- }
- std::cout << std::endl;
- assert(nrTokens == 5);
- }
-
- {
- Trie trie("#");
- int nrTokens = 0;
- size_t offset = 0;
- std::string word = "#bb#bbbb#b#bbb#bb#b#";
- std::string token;
- while(offset = trie.getNextToken(word, offset, token), token.length() > 0) {
- std::cout << "\"" << token << "\" ";
- nrTokens++;
- }
- std::cout << std::endl;
- assert(nrTokens == 6);
- }
-
- {
- Trie trie(" ");
- int nrTokens = 0;
- size_t offset = 0;
- std::string word = " this is to be tokenized";
- std::string token;
- while(offset = trie.getNextToken(word, offset, token), token.length() > 0) {
- std::cout << "\"" << token << "\" ";
- nrTokens++;
- }
- std::cout << std::endl;
- assert(nrTokens == 3);
- }
-
- {
- Trie trie("");
- trie.addWord("a");
- trie.addWord("b");
-
- trie.dump();
- }
-
- {
- Trie trie(".");
- trie.addWord("foo.bar");
- trie.addWord("foo.foo");
- trie.addWord("foo.foo.baz");
- trie.addWord("foz.foo.baz");
- trie.addWord("foz.foo");
-
- trie.dump();
-
- std::list<TrieNode*> childs;
-
- childs = trie.getChildsWithWords(trie.root);
- assert(childs.size() == 5);
-
- assert(trie.getNodeWithPrefix("") == trie.root);
-
- childs = trie.getWordsWithPrefix("");
- assert(childs.size() == 5);
- }
-} \ No newline at end of file