Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
prefix_tree_test.cc File Reference

Tests for Prefix Tree. More...

#include <gtest/gtest.h>
#include <prefix-tree.H>
#include <algorithm>
#include <vector>
Include dependency graph for prefix_tree_test.cc:

Go to the source code of this file.

Classes

class  PrefixTreeTest
 

Functions

 TEST_F (PrefixTreeTest, NodeConstruction)
 
 TEST_F (PrefixTreeTest, NodeSymbol)
 
 TEST_F (PrefixTreeTest, InitiallyNoChildren)
 
 TEST_F (PrefixTreeTest, InitiallyNotEndWord)
 
 TEST_F (PrefixTreeTest, MarkEndWord)
 
 TEST_F (PrefixTreeTest, SearchChildNotFound)
 
 TEST_F (PrefixTreeTest, InsertAndSearchChild)
 
 TEST_F (PrefixTreeTest, ChildrenSortedOrder)
 
 TEST_F (PrefixTreeTest, GreaterChild)
 
 TEST_F (PrefixTreeTest, InsertSingleWord)
 
 TEST_F (PrefixTreeTest, InsertDuplicateWord)
 
 TEST_F (PrefixTreeTest, InsertMultipleWords)
 
 TEST_F (PrefixTreeTest, InsertWordsWithCommonPrefix)
 
 TEST_F (PrefixTreeTest, InsertEmptyString)
 
 TEST_F (PrefixTreeTest, InsertSingleCharacter)
 
 TEST_F (PrefixTreeTest, PrefixNotAWord)
 
 TEST_F (PrefixTreeTest, WordThenPrefix)
 
 TEST_F (PrefixTreeTest, PrefixThenWord)
 
 TEST_F (PrefixTreeTest, SearchWordNotFound)
 
 TEST_F (PrefixTreeTest, SearchWordFound)
 
 TEST_F (PrefixTreeTest, ContainsNonExistent)
 
 TEST_F (PrefixTreeTest, SearchPrefixEmpty)
 
 TEST_F (PrefixTreeTest, SearchPrefixFullMatch)
 
 TEST_F (PrefixTreeTest, SearchPrefixPartialMatch)
 
 TEST_F (PrefixTreeTest, SearchPrefixNoMatch)
 
 TEST_F (PrefixTreeTest, WordsEmpty)
 
 TEST_F (PrefixTreeTest, WordsSingle)
 
 TEST_F (PrefixTreeTest, WordsMultiple)
 
 TEST_F (PrefixTreeTest, WordsWithCommonPrefixes)
 
 TEST_F (PrefixTreeTest, CloneEmpty)
 
 TEST_F (PrefixTreeTest, CloneWithWords)
 
 TEST_F (PrefixTreeTest, ToStringEmpty)
 
 TEST_F (PrefixTreeTest, ToStringWithWord)
 
 TEST_F (PrefixTreeTest, LongWord)
 
 TEST_F (PrefixTreeTest, ManyWords)
 
 TEST_F (PrefixTreeTest, SpecialCharacters)
 
 TEST_F (PrefixTreeTest, NumericStrings)
 
 TEST_F (PrefixTreeTest, CountEmpty)
 
 TEST_F (PrefixTreeTest, CountSingle)
 
 TEST_F (PrefixTreeTest, CountMultiple)
 
 TEST_F (PrefixTreeTest, CountWithPrefixes)
 
 TEST_F (PrefixTreeTest, WordsWithPrefixEmpty)
 
 TEST_F (PrefixTreeTest, WordsWithPrefixMatch)
 
 TEST_F (PrefixTreeTest, WordsWithPrefixExactWord)
 
 TEST_F (PrefixTreeTest, WordsWithPrefixNoMatch)
 
 TEST (PrefixTreeDestroyTest, DestroyWorks)
 
int main (int argc, char **argv)
 

Detailed Description

Tests for Prefix Tree.

Comprehensive test suite for prefix-tree.H (Trie)

Tests all aspects of the Cnode prefix tree including:

  • Node construction and basic operations
  • Word insertion and search
  • Prefix search
  • Tree traversal and word extraction
  • Cloning
  • Edge cases

Definition in file prefix_tree_test.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 568 of file prefix_tree_test.cc.

References Aleph::maps().

◆ TEST()

TEST ( PrefixTreeDestroyTest  ,
DestroyWorks   
)

Definition at line 548 of file prefix_tree_test.cc.

References Aleph::maps().

◆ TEST_F() [1/45]

TEST_F ( PrefixTreeTest  ,
ChildrenSortedOrder   
)

◆ TEST_F() [2/45]

TEST_F ( PrefixTreeTest  ,
CloneEmpty   
)

Definition at line 377 of file prefix_tree_test.cc.

References Aleph::HTList::is_empty(), Aleph::maps(), and root().

◆ TEST_F() [3/45]

TEST_F ( PrefixTreeTest  ,
CloneWithWords   
)

Definition at line 388 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [4/45]

TEST_F ( PrefixTreeTest  ,
ContainsNonExistent   
)

Definition at line 273 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [5/45]

TEST_F ( PrefixTreeTest  ,
CountEmpty   
)

Definition at line 480 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [6/45]

TEST_F ( PrefixTreeTest  ,
CountMultiple   
)

Definition at line 491 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [7/45]

TEST_F ( PrefixTreeTest  ,
CountSingle   
)

Definition at line 485 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [8/45]

TEST_F ( PrefixTreeTest  ,
CountWithPrefixes   
)

Definition at line 499 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [9/45]

TEST_F ( PrefixTreeTest  ,
GreaterChild   
)

Definition at line 161 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [10/45]

TEST_F ( PrefixTreeTest  ,
InitiallyNoChildren   
)

Definition at line 101 of file prefix_tree_test.cc.

References Aleph::Cnode::children(), and Aleph::maps().

◆ TEST_F() [11/45]

TEST_F ( PrefixTreeTest  ,
InitiallyNotEndWord   
)

Definition at line 107 of file prefix_tree_test.cc.

References Aleph::Cnode::is_end_word(), and Aleph::maps().

◆ TEST_F() [12/45]

TEST_F ( PrefixTreeTest  ,
InsertAndSearchChild   
)

Definition at line 134 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [13/45]

TEST_F ( PrefixTreeTest  ,
InsertDuplicateWord   
)

Definition at line 182 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [14/45]

TEST_F ( PrefixTreeTest  ,
InsertEmptyString   
)

Definition at line 210 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [15/45]

TEST_F ( PrefixTreeTest  ,
InsertMultipleWords   
)

Definition at line 188 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [16/45]

TEST_F ( PrefixTreeTest  ,
InsertSingleCharacter   
)

Definition at line 217 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [17/45]

TEST_F ( PrefixTreeTest  ,
InsertSingleWord   
)

Definition at line 176 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [18/45]

TEST_F ( PrefixTreeTest  ,
InsertWordsWithCommonPrefix   
)

Definition at line 199 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [19/45]

TEST_F ( PrefixTreeTest  ,
LongWord   
)

Definition at line 435 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [20/45]

TEST_F ( PrefixTreeTest  ,
ManyWords   
)

Definition at line 442 of file prefix_tree_test.cc.

References Aleph::maps(), N, and root().

◆ TEST_F() [21/45]

TEST_F ( PrefixTreeTest  ,
MarkEndWord   
)

◆ TEST_F() [22/45]

TEST_F ( PrefixTreeTest  ,
NodeConstruction   
)

Definition at line 86 of file prefix_tree_test.cc.

References Aleph::maps(), and Aleph::Cnode::symbol().

◆ TEST_F() [23/45]

TEST_F ( PrefixTreeTest  ,
NodeSymbol   
)

Definition at line 92 of file prefix_tree_test.cc.

References Aleph::maps(), and Aleph::Cnode::symbol().

◆ TEST_F() [24/45]

TEST_F ( PrefixTreeTest  ,
NumericStrings   
)

Definition at line 466 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [25/45]

TEST_F ( PrefixTreeTest  ,
PrefixNotAWord   
)

Definition at line 223 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [26/45]

TEST_F ( PrefixTreeTest  ,
PrefixThenWord   
)

Definition at line 243 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [27/45]

TEST_F ( PrefixTreeTest  ,
SearchChildNotFound   
)

Definition at line 129 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [28/45]

TEST_F ( PrefixTreeTest  ,
SearchPrefixEmpty   
)

Definition at line 286 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [29/45]

TEST_F ( PrefixTreeTest  ,
SearchPrefixFullMatch   
)

Definition at line 294 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [30/45]

TEST_F ( PrefixTreeTest  ,
SearchPrefixNoMatch   
)

Definition at line 314 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [31/45]

TEST_F ( PrefixTreeTest  ,
SearchPrefixPartialMatch   
)

Definition at line 304 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [32/45]

TEST_F ( PrefixTreeTest  ,
SearchWordFound   
)

Definition at line 264 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [33/45]

TEST_F ( PrefixTreeTest  ,
SearchWordNotFound   
)

Definition at line 256 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [34/45]

TEST_F ( PrefixTreeTest  ,
SpecialCharacters   
)

Definition at line 455 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [35/45]

TEST_F ( PrefixTreeTest  ,
ToStringEmpty   
)

Definition at line 414 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [36/45]

TEST_F ( PrefixTreeTest  ,
ToStringWithWord   
)

Definition at line 421 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [37/45]

TEST_F ( PrefixTreeTest  ,
WordsEmpty   
)

Definition at line 328 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [38/45]

TEST_F ( PrefixTreeTest  ,
WordsMultiple   
)

Definition at line 343 of file prefix_tree_test.cc.

References Aleph::maps(), root(), and w.

◆ TEST_F() [39/45]

TEST_F ( PrefixTreeTest  ,
WordsSingle   
)

Definition at line 334 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [40/45]

TEST_F ( PrefixTreeTest  ,
WordsWithCommonPrefixes   
)

Definition at line 362 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [41/45]

TEST_F ( PrefixTreeTest  ,
WordsWithPrefixEmpty   
)

Definition at line 511 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [42/45]

TEST_F ( PrefixTreeTest  ,
WordsWithPrefixExactWord   
)

Definition at line 529 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [43/45]

TEST_F ( PrefixTreeTest  ,
WordsWithPrefixMatch   
)

Definition at line 518 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [44/45]

TEST_F ( PrefixTreeTest  ,
WordsWithPrefixNoMatch   
)

Definition at line 539 of file prefix_tree_test.cc.

References Aleph::maps(), and root().

◆ TEST_F() [45/45]

TEST_F ( PrefixTreeTest  ,
WordThenPrefix   
)

Definition at line 234 of file prefix_tree_test.cc.

References Aleph::maps(), and root().