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

Tests for Rand Tree. More...

#include <gtest/gtest.h>
#include <numeric>
#include <tpl_rand_tree.H>
#include <tpl_binNodeUtils.H>
#include <random>
#include <set>
#include <vector>
#include <algorithm>
Include dependency graph for rand-tree.cc:

Go to the source code of this file.

Classes

class  NodePool
 

Typedefs

using Tree = Rand_Tree< int >
 
using Node = Tree::Node
 

Functions

template<typename NodeT >
std::vector< int > inorder_keys (NodeT *root)
 
 TEST (RandTree, EmptyTreeProperties)
 
 TEST (RandTree, SearchOnEmptyTreeReturnsNull)
 
 TEST (RandTree, RemoveFromEmptyTreeReturnsNull)
 
 TEST (RandTree, InsertSingleElement)
 
 TEST (RandTree, InsertMultipleElements)
 
 TEST (RandTree, InsertRejectsDuplicates)
 
 TEST (RandTree, InsertDupAllowsDuplicates)
 
 TEST (RandTree, InsertInAscendingOrder)
 
 TEST (RandTree, InsertInDescendingOrder)
 
 TEST (RandTree, SearchFindsExistingKey)
 
 TEST (RandTree, SearchReturnsNullForMissingKey)
 
 TEST (RandTree, SearchOrInsertReturnsExisting)
 
 TEST (RandTree, SearchOrInsertInsertsNew)
 
 TEST (RandTree, RemoveExistingKey)
 
 TEST (RandTree, RemoveReturnsNullForMissingKey)
 
 TEST (RandTree, RemoveRoot)
 
 TEST (RandTree, RemoveAllElements)
 
 TEST (RandTree, RemoveInOrder)
 
 TEST (RandTree, RemoveInReverseOrder)
 
 TEST (RandTree, SelectReturnsCorrectNode)
 
 TEST (RandTree, SelectOutOfRangeThrows)
 
 TEST (RandTree, PositionOfExistingKey)
 
 TEST (RandTree, PositionOfMissingKey)
 
 TEST (RandTree, FindPositionOfExistingKey)
 
 TEST (RandTree, FindPositionOfMissingKeyInMiddle)
 
 TEST (RandTree, FindPositionLessThanMin)
 
 TEST (RandTree, FindPositionGreaterThanMax)
 
 TEST (RandTree, RemovePosValidPosition)
 
 TEST (RandTree, RemovePosFirst)
 
 TEST (RandTree, RemovePosLast)
 
 TEST (RandTree, SplitKeyNotInTree)
 
 TEST (RandTree, SplitKeyInTree)
 
 TEST (RandTree, SplitKeyDup)
 
 TEST (RandTree, SplitPos)
 
 TEST (RandTree, JoinWithNoDuplicates)
 
 TEST (RandTree, JoinWithDuplicates)
 
 TEST (RandTree, JoinDup)
 
 TEST (RandTree, JoinExclusive)
 
 TEST (RandTree, IteratorTraversesInOrder)
 
 TEST (RandTree, IteratorOnEmptyTree)
 
 TEST (RandTree, IteratorAfterRemoval)
 
 TEST (RandTree, SwapTrees)
 
 TEST (RandTree, SeedAffectsStructure)
 
 TEST (RandTree, CustomComparatorGreater)
 
 TEST (RandTree, NegativeKeys)
 
 TEST (RandTree, SingleElementOperations)
 
 TEST (RandTree, RandomInsertSearchRemove)
 
 TEST (RandTree, LargeTreeOperations)
 
 TEST (RandTreeVtl, BasicOperations)
 
 TEST (RandTree, VerifyDetectsValidTree)
 
 TEST (RandTree, GetRootReturnsReference)
 
 TEST (RandTree, KeyCompAndGetCompare)
 
 TEST (RandTree, GslRngObjectNotNull)
 
 TEST (RandTree, SetSeedChangesSequence)
 

Detailed Description

Tests for Rand Tree.

Definition in file rand-tree.cc.

Typedef Documentation

◆ Node

using Node = Tree::Node

Definition at line 56 of file rand-tree.cc.

◆ Tree

using Tree = Rand_Tree<int>

Definition at line 55 of file rand-tree.cc.

Function Documentation

◆ inorder_keys()

template<typename NodeT >
std::vector< int > inorder_keys ( NodeT *  root)

◆ TEST() [1/54]

TEST ( RandTree  ,
CustomComparatorGreater   
)

Definition at line 876 of file rand-tree.cc.

References Aleph::blossom_maximum_cardinality_matching(), k, KEY, and nodes.

◆ TEST() [2/54]

TEST ( RandTree  ,
EmptyTreeProperties   
)

Definition at line 104 of file rand-tree.cc.

References Aleph::blossom_maximum_cardinality_matching().

◆ TEST() [3/54]

TEST ( RandTree  ,
FindPositionGreaterThanMax   
)

◆ TEST() [4/54]

TEST ( RandTree  ,
FindPositionLessThanMin   
)

◆ TEST() [5/54]

TEST ( RandTree  ,
FindPositionOfExistingKey   
)

◆ TEST() [6/54]

TEST ( RandTree  ,
FindPositionOfMissingKeyInMiddle   
)

◆ TEST() [7/54]

TEST ( RandTree  ,
GetRootReturnsReference   
)

◆ TEST() [8/54]

TEST ( RandTree  ,
GslRngObjectNotNull   
)

Definition at line 1126 of file rand-tree.cc.

References Aleph::blossom_maximum_cardinality_matching(), and rng.

◆ TEST() [9/54]

TEST ( RandTree  ,
InsertDupAllowsDuplicates   
)

Definition at line 181 of file rand-tree.cc.

References Aleph::blossom_maximum_cardinality_matching().

◆ TEST() [10/54]

TEST ( RandTree  ,
InsertInAscendingOrder   
)

◆ TEST() [11/54]

TEST ( RandTree  ,
InsertInDescendingOrder   
)

◆ TEST() [12/54]

TEST ( RandTree  ,
InsertMultipleElements   
)

◆ TEST() [13/54]

TEST ( RandTree  ,
InsertRejectsDuplicates   
)

◆ TEST() [14/54]

TEST ( RandTree  ,
InsertSingleElement   
)

◆ TEST() [15/54]

TEST ( RandTree  ,
IteratorAfterRemoval   
)

◆ TEST() [16/54]

TEST ( RandTree  ,
IteratorOnEmptyTree   
)

Definition at line 793 of file rand-tree.cc.

References Aleph::blossom_maximum_cardinality_matching().

◆ TEST() [17/54]

TEST ( RandTree  ,
IteratorTraversesInOrder   
)

◆ TEST() [18/54]

TEST ( RandTree  ,
JoinDup   
)

Definition at line 733 of file rand-tree.cc.

References Aleph::blossom_maximum_cardinality_matching(), and k.

◆ TEST() [19/54]

TEST ( RandTree  ,
JoinExclusive   
)

Definition at line 751 of file rand-tree.cc.

References Aleph::blossom_maximum_cardinality_matching(), k, and keys.

◆ TEST() [20/54]

TEST ( RandTree  ,
JoinWithDuplicates   
)

Definition at line 707 of file rand-tree.cc.

References Aleph::blossom_maximum_cardinality_matching(), k, and keys.

◆ TEST() [21/54]

TEST ( RandTree  ,
JoinWithNoDuplicates   
)

Definition at line 684 of file rand-tree.cc.

References Aleph::blossom_maximum_cardinality_matching(), k, and keys.

◆ TEST() [22/54]

TEST ( RandTree  ,
KeyCompAndGetCompare   
)

Definition at line 1112 of file rand-tree.cc.

References Aleph::blossom_maximum_cardinality_matching().

◆ TEST() [23/54]

TEST ( RandTree  ,
LargeTreeOperations   
)

◆ TEST() [24/54]

TEST ( RandTree  ,
NegativeKeys   
)

◆ TEST() [25/54]

TEST ( RandTree  ,
PositionOfExistingKey   
)

◆ TEST() [26/54]

TEST ( RandTree  ,
PositionOfMissingKey   
)

◆ TEST() [27/54]

TEST ( RandTree  ,
RandomInsertSearchRemove   
)

◆ TEST() [28/54]

TEST ( RandTree  ,
RemoveAllElements   
)

◆ TEST() [29/54]

TEST ( RandTree  ,
RemoveExistingKey   
)

◆ TEST() [30/54]

TEST ( RandTree  ,
RemoveFromEmptyTreeReturnsNull   
)

◆ TEST() [31/54]

TEST ( RandTree  ,
RemoveInOrder   
)

◆ TEST() [32/54]

TEST ( RandTree  ,
RemoveInReverseOrder   
)

◆ TEST() [33/54]

TEST ( RandTree  ,
RemovePosFirst   
)

◆ TEST() [34/54]

TEST ( RandTree  ,
RemovePosLast   
)

◆ TEST() [35/54]

TEST ( RandTree  ,
RemovePosValidPosition   
)

◆ TEST() [36/54]

TEST ( RandTree  ,
RemoveReturnsNullForMissingKey   
)

◆ TEST() [37/54]

TEST ( RandTree  ,
RemoveRoot   
)

◆ TEST() [38/54]

TEST ( RandTree  ,
SearchFindsExistingKey   
)

◆ TEST() [39/54]

TEST ( RandTree  ,
SearchOnEmptyTreeReturnsNull   
)

◆ TEST() [40/54]

TEST ( RandTree  ,
SearchOrInsertInsertsNew   
)

◆ TEST() [41/54]

TEST ( RandTree  ,
SearchOrInsertReturnsExisting   
)

◆ TEST() [42/54]

TEST ( RandTree  ,
SearchReturnsNullForMissingKey   
)

◆ TEST() [43/54]

TEST ( RandTree  ,
SeedAffectsStructure   
)

Definition at line 847 of file rand-tree.cc.

References Aleph::blossom_maximum_cardinality_matching(), and k.

◆ TEST() [44/54]

TEST ( RandTree  ,
SelectOutOfRangeThrows   
)

◆ TEST() [45/54]

TEST ( RandTree  ,
SelectReturnsCorrectNode   
)

◆ TEST() [46/54]

TEST ( RandTree  ,
SetSeedChangesSequence   
)

Definition at line 1134 of file rand-tree.cc.

References Aleph::blossom_maximum_cardinality_matching(), and k.

◆ TEST() [47/54]

TEST ( RandTree  ,
SingleElementOperations   
)

◆ TEST() [48/54]

TEST ( RandTree  ,
SplitKeyDup   
)

◆ TEST() [49/54]

TEST ( RandTree  ,
SplitKeyInTree   
)

◆ TEST() [50/54]

TEST ( RandTree  ,
SplitKeyNotInTree   
)

◆ TEST() [51/54]

TEST ( RandTree  ,
SplitPos   
)

◆ TEST() [52/54]

TEST ( RandTree  ,
SwapTrees   
)

Definition at line 824 of file rand-tree.cc.

References Aleph::blossom_maximum_cardinality_matching(), and k.

◆ TEST() [53/54]

TEST ( RandTree  ,
VerifyDetectsValidTree   
)

◆ TEST() [54/54]

TEST ( RandTreeVtl  ,
BasicOperations   
)

Definition at line 1056 of file rand-tree.cc.

References Aleph::blossom_maximum_cardinality_matching(), and k.