|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Tests for Bin Node Utils. More...
#include <algorithm>#include <cctype>#include <functional>#include <new>#include <random>#include <sstream>#include <set>#include <stdexcept>#include <string>#include <vector>#include <gtest/gtest.h>#include <tpl_binNode.H>#include <tpl_binNodeUtils.H>#include <tpl_dynArray.H>Go to the source code of this file.
Functions | |
| TEST (BinNodeUtils, PrefixInfixSuffixLists) | |
| TEST (BinNodeUtils, ForEachTraversals) | |
| TEST (BinNodeUtils, ComputeNodesInLevel) | |
| TEST (BinNodeUtils, InternalPathLength) | |
| TEST (BinNodeUtils, BuildTreeFromPreorderAndInorder) | |
| TEST (BinNodeUtils, BuildTreeFromPostorderAndInorder) | |
| TEST (BinNodeUtils, SaveTreeLoadTreeRoundtrip) | |
| TEST (BinNodeUtils, LoadTreeKeysInPrefixThrowsOnShortInput) | |
| TEST (BinNodeUtils, SaveTreeInArrayOfCharsLoadTreeFromArrayRoundtrip) | |
| TEST (BinNodeUtils, SaveTreeInArrayEscapesKeys) | |
| TEST (BinNodeUtils, ThreadedTraversalsDoNotCorruptTree) | |
| TEST (BinNodeUtils, InsertInBstRejectsDuplicates) | |
| TEST (BinNodeUtils, InsertDupInBstAllowsDuplicates) | |
| TEST (BinNodeUtils, CheckBstRejectsGlobalViolation) | |
| TEST (BinNodeUtils, SearchOrInsertInBst) | |
| TEST (BinNodeUtils, RemoveFromBstReturnsDetachedNode) | |
| TEST (BinNodeUtils, JoinExclusiveEmptiesInputs) | |
| TEST (BinNodeUtils, JoinPreorderStoresDuplicates) | |
| TEST (BinNodeUtils, JoinStoresDuplicates) | |
| TEST (BinNodeUtils, SplitKeyRecOnlySplitsWhenKeyAbsent) | |
| TEST (BinNodeUtils, SplitKeyDupRecSplitsAndEmptiesRoot) | |
| TEST (BinNodeUtils, SplitKeyIterativeSplits) | |
| TEST (BinNodeUtils, InfixIteratorTraversesInSortedOrder) | |
| TEST (BinNodeUtils, IteratorsHandleTreesDeeperThanMaxHeight) | |
| TEST (BinNodeUtils, RotationsPreserveInorder) | |
| TEST (BinNodeUtils, FindMinMax) | |
| TEST (BinNodeUtils, FindSuccessorAndPredecessor) | |
| TEST (BinNodeUtils, SearchParentReturnsNodeAndUpdatesParent) | |
| TEST (BinNodeUtils, SearchRankParent) | |
| TEST (BinNodeUtils, InsertRootRecInsertsAndRotatesToRoot) | |
| TEST (BinNodeUtils, InsertRootRecRejectsDuplicate) | |
| TEST (BinNodeUtils, InsertRootRequiresKeyAbsent) | |
| TEST (BinNodeUtils, InsertDupRootAlwaysInserts) | |
| TEST (BinNodeUtils, RemoveFromBstRespectsComparator) | |
| TEST (BinNodeUtils, TreeToBitsAndBitsToTreeRoundtripShapeAndKeys) | |
| TEST (BinNodeUtils, BitsToTreeThrowsOnInvalidBits) | |
| TEST (BinNodeUtils, PreorderToBstBuildsValidTree) | |
| TEST (BinNodeUtils, Property_InsertRemoveRandom_StableInvariants) | |
| TEST (BinNodeUtils, DegenerateTreesAreMeasuredCopiedAndDestroyedWithoutRecursion) | |
| TEST (BinNodeUtils, CombTreeIsTallerThanTheBoundOfTheRecursions) | |
| TEST (BinNodeUtils, CopyAndDestroyAccountForEveryNode) | |
| TEST (BinNodeUtils, KeyDestructorsRunOnceOnADegenerateTreeWithoutRecursion) | |
| TEST (BinNodeUtils, NodesAreDisposedInPostorderWithClearedLinksWhateverTheDepth) | |
| TEST (BinNodeUtils, DestroyRecFreesTheNodesInPostorderWhateverTheDepth) | |
| TEST (BinNodeUtils, KeyDestructorsRunInPostorderAndLeaveTheLinksCleared) | |
Tests for Bin Node Utils.
Definition in file bin-node-utils.cc.
| TEST | ( | BinNodeUtils | , |
| BitsToTreeThrowsOnInvalidBits | |||
| ) |
Definition at line 922 of file bin-node-utils.cc.
References Aleph::bits(), and Aleph::bits_to_tree().
| TEST | ( | BinNodeUtils | , |
| BuildTreeFromPostorderAndInorder | |||
| ) |
Definition at line 323 of file bin-node-utils.cc.
References Aleph::check_bst(), delete_tree(), inorder, and root().
| TEST | ( | BinNodeUtils | , |
| BuildTreeFromPreorderAndInorder | |||
| ) |
Definition at line 310 of file bin-node-utils.cc.
References Aleph::check_bst(), delete_tree(), inorder, and root().
| TEST | ( | BinNodeUtils | , |
| CheckBstRejectsGlobalViolation | |||
| ) |
Definition at line 503 of file bin-node-utils.cc.
References Aleph::check_bst(), LLINK, RLINK, and root().
| TEST | ( | BinNodeUtils | , |
| CombTreeIsTallerThanTheBoundOfTheRecursions | |||
| ) |
Definition at line 1084 of file bin-node-utils.cc.
References Aleph::Bin_Tree_Depth_Bound, Aleph::computeHeightRec(), Aleph::copy(), Aleph::copyRec(), Aleph::destroyRec(), KEY, LLINK, RLINK, and root().
| TEST | ( | BinNodeUtils | , |
| ComputeNodesInLevel | |||
| ) |
Definition at line 280 of file bin-node-utils.cc.
References Aleph::compute_nodes_in_level(), l1, l2, LLINK, RLINK, and root().
| TEST | ( | BinNodeUtils | , |
| CopyAndDestroyAccountForEveryNode | |||
| ) |
Definition at line 1124 of file bin-node-utils.cc.
References Aleph::areSimilar(), Aleph::computeHeightRec(), Aleph::copy(), Aleph::copyRec(), Aleph::destroyRec(), Aleph::insert_in_bst(), k, KEY, keys, nodes, rng, root(), and value.
| TEST | ( | BinNodeUtils | , |
| DegenerateTreesAreMeasuredCopiedAndDestroyedWithoutRecursion | |||
| ) |
Definition at line 1054 of file bin-node-utils.cc.
References Aleph::computeHeightRec(), Aleph::copy(), Aleph::copyRec(), Aleph::destroyRec(), and root().
| TEST | ( | BinNodeUtils | , |
| DestroyRecFreesTheNodesInPostorderWhateverTheDepth | |||
| ) |
Definition at line 1382 of file bin-node-utils.cc.
References Aleph::destroyRec().
| TEST | ( | BinNodeUtils | , |
| FindMinMax | |||
| ) |
Definition at line 747 of file bin-node-utils.cc.
References Aleph::find_max(), Aleph::find_min(), Aleph::insert_in_bst(), k, KEY, and root().
| TEST | ( | BinNodeUtils | , |
| FindSuccessorAndPredecessor | |||
| ) |
Definition at line 758 of file bin-node-utils.cc.
References Aleph::find_predecessor(), Aleph::find_successor(), Aleph::insert_in_bst(), k, KEY, pred, root(), and Aleph::searchInBinTree().
| TEST | ( | BinNodeUtils | , |
| ForEachTraversals | |||
| ) |
| TEST | ( | BinNodeUtils | , |
| InfixIteratorTraversesInSortedOrder | |||
| ) |
Definition at line 668 of file bin-node-utils.cc.
References Aleph::BinNodeInfixIterator< Node >::get_curr_ne(), Aleph::BinNodeInfixIterator< Node >::has_curr(), Aleph::insert_in_bst(), k, KEY, Aleph::BinNodeInfixIterator< Node >::next_ne(), and root().
| TEST | ( | BinNodeUtils | , |
| InsertDupInBstAllowsDuplicates | |||
| ) |
Definition at line 490 of file bin-node-utils.cc.
References Aleph::check_bst(), inorder, Aleph::insert_dup_in_bst(), and root().
| TEST | ( | BinNodeUtils | , |
| InsertDupRootAlwaysInserts | |||
| ) |
Definition at line 860 of file bin-node-utils.cc.
References Aleph::insert_dup_root(), Aleph::insert_in_bst(), k, and root().
| TEST | ( | BinNodeUtils | , |
| InsertInBstRejectsDuplicates | |||
| ) |
Definition at line 475 of file bin-node-utils.cc.
References Aleph::insert_in_bst(), and root().
| TEST | ( | BinNodeUtils | , |
| InsertRootRecInsertsAndRotatesToRoot | |||
| ) |
Definition at line 815 of file bin-node-utils.cc.
References Aleph::insert_in_bst(), Aleph::insert_root_rec(), k, KEY, and root().
| TEST | ( | BinNodeUtils | , |
| InsertRootRecRejectsDuplicate | |||
| ) |
Definition at line 831 of file bin-node-utils.cc.
References inorder, Aleph::insert_in_bst(), Aleph::insert_root_rec(), k, and root().
| TEST | ( | BinNodeUtils | , |
| InsertRootRequiresKeyAbsent | |||
| ) |
Definition at line 844 of file bin-node-utils.cc.
References Aleph::insert_in_bst(), Aleph::insert_root(), k, KEY, and root().
| TEST | ( | BinNodeUtils | , |
| InternalPathLength | |||
| ) |
Definition at line 300 of file bin-node-utils.cc.
References Aleph::internal_path_length(), LLINK, RLINK, and root().
| TEST | ( | BinNodeUtils | , |
| IteratorsHandleTreesDeeperThanMaxHeight | |||
| ) |
Definition at line 687 of file bin-node-utils.cc.
| TEST | ( | BinNodeUtils | , |
| JoinExclusiveEmptiesInputs | |||
| ) |
Definition at line 550 of file bin-node-utils.cc.
References inorder, Aleph::insert_in_bst(), k, and out.
| TEST | ( | BinNodeUtils | , |
| JoinPreorderStoresDuplicates | |||
| ) |
Definition at line 569 of file bin-node-utils.cc.
References inorder, Aleph::insert_in_bst(), Aleph::join_preorder(), k, and out.
| TEST | ( | BinNodeUtils | , |
| JoinStoresDuplicates | |||
| ) |
Definition at line 589 of file bin-node-utils.cc.
References inorder, Aleph::insert_in_bst(), Aleph::join(), k, and out.
| TEST | ( | BinNodeUtils | , |
| KeyDestructorsRunInPostorderAndLeaveTheLinksCleared | |||
| ) |
Definition at line 1400 of file bin-node-utils.cc.
References Aleph::callKeyDestructorsRec(), LLINK, nodes, and RLINK.
| TEST | ( | BinNodeUtils | , |
| KeyDestructorsRunOnceOnADegenerateTreeWithoutRecursion | |||
| ) |
Definition at line 1169 of file bin-node-utils.cc.
References Aleph::callKeyDestructorsRec(), LLINK, RLINK, and root().
| TEST | ( | BinNodeUtils | , |
| LoadTreeKeysInPrefixThrowsOnShortInput | |||
| ) |
Definition at line 352 of file bin-node-utils.cc.
References delete_tree(), LLINK, Aleph::load_tree_keys_in_prefix(), and root().
| TEST | ( | BinNodeUtils | , |
| NodesAreDisposedInPostorderWithClearedLinksWhateverTheDepth | |||
| ) |
Definition at line 1333 of file bin-node-utils.cc.
References Aleph::Bin_Tree_Depth_Bound, Aleph::count(), Aleph::dispose_tree_by_link_inversion(), Aleph::dispose_tree_nodes(), KEY, LLINK, nodes, and RLINK.
| TEST | ( | BinNodeUtils | , |
| PrefixInfixSuffixLists | |||
| ) |
Definition at line 247 of file bin-node-utils.cc.
References Aleph::in_nodes(), Aleph::infix(), LLINK, Aleph::prefix(), RLINK, root(), and Aleph::suffix().
| TEST | ( | BinNodeUtils | , |
| PreorderToBstBuildsValidTree | |||
| ) |
Definition at line 931 of file bin-node-utils.cc.
References delete_tree(), inorder, and root().
| TEST | ( | BinNodeUtils | , |
| Property_InsertRemoveRandom_StableInvariants | |||
| ) |
Definition at line 949 of file bin-node-utils.cc.
References Aleph::insert_in_bst(), k, KEY, Aleph::remove_from_bst(), rng, and root().
| TEST | ( | BinNodeUtils | , |
| RemoveFromBstRespectsComparator | |||
| ) |
Definition at line 872 of file bin-node-utils.cc.
References Aleph::check_bst(), Aleph::Greater, k, KEY, and root().
| TEST | ( | BinNodeUtils | , |
| RemoveFromBstReturnsDetachedNode | |||
| ) |
Definition at line 530 of file bin-node-utils.cc.
References Aleph::insert_in_bst(), k, KEY, LLINK, Aleph::remove_from_bst(), RLINK, and root().
| TEST | ( | BinNodeUtils | , |
| RotationsPreserveInorder | |||
| ) |
Definition at line 729 of file bin-node-utils.cc.
References inorder, LLINK, r, RLINK, Aleph::rotate_to_left(), and Aleph::rotate_to_right().
| TEST | ( | BinNodeUtils | , |
| SaveTreeInArrayEscapesKeys | |||
| ) |
Definition at line 396 of file bin-node-utils.cc.
References delete_tree(), Aleph::BinNode< Key >::get_key(), inorder, KEY, keys, LLINK, out, RLINK, root(), and Aleph::tree_to_bits().
| TEST | ( | BinNodeUtils | , |
| SaveTreeInArrayOfCharsLoadTreeFromArrayRoundtrip | |||
| ) |
Definition at line 365 of file bin-node-utils.cc.
References Aleph::check_bst(), delete_tree(), inorder, keys, LLINK, out, RLINK, root(), and Aleph::tree_to_bits().
| TEST | ( | BinNodeUtils | , |
| SaveTreeLoadTreeRoundtrip | |||
| ) |
Definition at line 336 of file bin-node-utils.cc.
References Aleph::check_bst(), delete_tree(), inorder, LLINK, RLINK, root(), and Aleph::save_tree().
| TEST | ( | BinNodeUtils | , |
| SearchOrInsertInBst | |||
| ) |
Definition at line 514 of file bin-node-utils.cc.
References KEY, root(), and Aleph::search_or_insert_in_bst().
| TEST | ( | BinNodeUtils | , |
| SearchParentReturnsNodeAndUpdatesParent | |||
| ) |
Definition at line 780 of file bin-node-utils.cc.
References Aleph::insert_in_bst(), k, KEY, Aleph::BinNode< Key >::reset(), RLINK, root(), and Aleph::search_parent().
| TEST | ( | BinNodeUtils | , |
| SearchRankParent | |||
| ) |
Definition at line 799 of file bin-node-utils.cc.
References Aleph::insert_in_bst(), k, KEY, root(), and Aleph::search_rank_parent().
| TEST | ( | BinNodeUtils | , |
| SplitKeyDupRecSplitsAndEmptiesRoot | |||
| ) |
Definition at line 628 of file bin-node-utils.cc.
References inorder, Aleph::insert_in_bst(), k, l, r, root(), and Aleph::split_key_dup_rec().
| TEST | ( | BinNodeUtils | , |
| SplitKeyIterativeSplits | |||
| ) |
Definition at line 648 of file bin-node-utils.cc.
References inorder, Aleph::insert_in_bst(), k, l, r, root(), and Aleph::split_key().
| TEST | ( | BinNodeUtils | , |
| SplitKeyRecOnlySplitsWhenKeyAbsent | |||
| ) |
Definition at line 609 of file bin-node-utils.cc.
References Aleph::check_bst(), inorder, Aleph::insert_in_bst(), k, l, r, root(), and Aleph::split_key_rec().
| TEST | ( | BinNodeUtils | , |
| ThreadedTraversalsDoNotCorruptTree | |||
| ) |
Definition at line 444 of file bin-node-utils.cc.
References Aleph::check_bst(), inorder, Aleph::inOrderThreaded(), LLINK, Aleph::preOrderThreaded(), RLINK, root(), Aleph::size(), and Aleph::tree_to_bits().
| TEST | ( | BinNodeUtils | , |
| TreeToBitsAndBitsToTreeRoundtripShapeAndKeys | |||
| ) |
Definition at line 894 of file bin-node-utils.cc.
References Aleph::bits(), delete_tree(), inorder, keys, LLINK, RLINK, root(), Aleph::size(), and Aleph::tree_to_bits().