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

One battery of tests for every binary search tree of the library. More...

#include "search_trees_test_common.H"
#include <algorithm>
#include <iterator>
#include <numeric>
#include <optional>
#include <random>
#include <set>
#include <sstream>
#include <stdexcept>
#include <utility>
Include dependency graph for search_trees_battery_test.cc:

Go to the source code of this file.

Concepts

concept  @1065::Sized_Tree
 
concept  @1065::Ranked_Tree
 
concept  @1065::Removes_By_Position
 

Functions

 TYPED_TEST (SearchTreeBattery, EveryInsertionOrderOfUpToEightKeys)
 
 TYPED_TEST (SearchTreeBattery, EveryOrderOfSearchOrInsertOfUpToSevenKeys)
 
 TYPED_TEST (SearchTreeBattery, EveryRemovalOrderFromEveryTreeOfUpToSixKeys)
 
 TYPED_TEST (SearchTreeBattery, EveryRemovalOrderOfSevenKeysFromGivenTrees)
 
 TYPED_TEST (SearchTreeBattery, RandomOperationsOnFewKeys)
 
 TYPED_TEST (SearchTreeBattery, RandomOperationsOnManyKeys)
 
 TYPED_TEST (SearchTreeBattery, RandomOperationsWithRepeatedKeys)
 
 TYPED_TEST (SearchTreeBattery, AdverseInsertionAndRemovalOrders)
 
 TYPED_TEST (SearchTreeBattery, LongAscendingAndDescendingRuns)
 
 TYPED_TEST (SearchTreeBattery, ManyNodesWithTheSameKey)
 
 TYPED_TEST (SearchTreeBattery, FewKeysRepeatedManyTimes)
 
 TYPED_TEST (PositionalRemovalBattery, EverySequenceOfPositionsOfUpToSevenKeys)
 
 TYPED_TEST (PositionalRemovalBattery, RemovePosBeyondTheLastKeyThrows)
 
 TYPED_TEST (RankedTreeBattery, SelectBeyondTheLastKeyThrows)
 

Detailed Description

One battery of tests for every binary search tree of the library.

Each tree runs next to a std::multiset that says what it must hold. After every operation the tree must pass its own verify() (the order of the keys and the invariant of its type: AVL balance, red-black colors, heap of priorities, subtree counters) and its keys in order must be the ones of the multiset. Where it applies, size(), search(), select() and position() are compared too, and the height is bounded by what the invariant guarantees, which does not depend on verify() being right.

The sequences of operations are:

  • every order of insertion of up to 8 keys (46 233 sequences), and of up to 7 keys with search_or_insert();
  • every order of removal of up to 6 keys, from each tree that some order of insertion builds;
  • every order of removal of 7 keys from a few given trees, and every sequence of removals by position in the trees that have remove_pos();
  • long random mixes of insertions, removals and searches, with and without repeated keys;
  • the orders that usually break a tree: ascending, descending, alternating between both ends, from the middle outwards, and repeated keys.

Definition in file search_trees_battery_test.cc.

Function Documentation

◆ TYPED_TEST() [1/14]

TYPED_TEST ( PositionalRemovalBattery  ,
EverySequenceOfPositionsOfUpToSevenKeys   
)

Definition at line 875 of file search_trees_battery_test.cc.

References Aleph::and, and seed.

◆ TYPED_TEST() [2/14]

TYPED_TEST ( PositionalRemovalBattery  ,
RemovePosBeyondTheLastKeyThrows   
)

◆ TYPED_TEST() [3/14]

TYPED_TEST ( RankedTreeBattery  ,
SelectBeyondTheLastKeyThrows   
)

◆ TYPED_TEST() [4/14]

TYPED_TEST ( SearchTreeBattery  ,
AdverseInsertionAndRemovalOrders   
)

Definition at line 774 of file search_trees_battery_test.cc.

References seed.

◆ TYPED_TEST() [5/14]

TYPED_TEST ( SearchTreeBattery  ,
EveryInsertionOrderOfUpToEightKeys   
)

Definition at line 546 of file search_trees_battery_test.cc.

References Aleph::to_string().

◆ TYPED_TEST() [6/14]

TYPED_TEST ( SearchTreeBattery  ,
EveryOrderOfSearchOrInsertOfUpToSevenKeys   
)

Definition at line 576 of file search_trees_battery_test.cc.

References Aleph::to_string().

◆ TYPED_TEST() [7/14]

TYPED_TEST ( SearchTreeBattery  ,
EveryRemovalOrderFromEveryTreeOfUpToSixKeys   
)

Definition at line 608 of file search_trees_battery_test.cc.

References seed, and Aleph::to_string().

◆ TYPED_TEST() [8/14]

TYPED_TEST ( SearchTreeBattery  ,
EveryRemovalOrderOfSevenKeysFromGivenTrees   
)

Definition at line 653 of file search_trees_battery_test.cc.

References seed, and Aleph::to_string().

◆ TYPED_TEST() [9/14]

TYPED_TEST ( SearchTreeBattery  ,
FewKeysRepeatedManyTimes   
)

Definition at line 844 of file search_trees_battery_test.cc.

References seed.

◆ TYPED_TEST() [10/14]

TYPED_TEST ( SearchTreeBattery  ,
LongAscendingAndDescendingRuns   
)

Definition at line 792 of file search_trees_battery_test.cc.

◆ TYPED_TEST() [11/14]

TYPED_TEST ( SearchTreeBattery  ,
ManyNodesWithTheSameKey   
)

Definition at line 822 of file search_trees_battery_test.cc.

◆ TYPED_TEST() [12/14]

TYPED_TEST ( SearchTreeBattery  ,
RandomOperationsOnFewKeys   
)

Definition at line 750 of file search_trees_battery_test.cc.

References seed.

◆ TYPED_TEST() [13/14]

TYPED_TEST ( SearchTreeBattery  ,
RandomOperationsOnManyKeys   
)

Definition at line 756 of file search_trees_battery_test.cc.

References seed.

◆ TYPED_TEST() [14/14]

TYPED_TEST ( SearchTreeBattery  ,
RandomOperationsWithRepeatedKeys   
)

Definition at line 763 of file search_trees_battery_test.cc.

References seed.