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

Exhaustive tests for ahSort.H sorting functions. More...

#include <gtest/gtest.h>
#include <vector>
#include <deque>
#include <algorithm>
#include <functional>
#include <random>
#include <string>
#include <type_traits>
#include <ahSort.H>
#include <tpl_dynArray.H>
#include <tpl_dynList.H>
#include <tpl_dynDlist.H>
Include dependency graph for ahSort_test.cc:

Go to the source code of this file.

Classes

class  DynListSortTest
 
class  DynDlistSortTest
 
class  DynArraySortTest
 
class  ArraySortTest
 

Functions

 TEST_F (DynListSortTest, SortReturnsSortedCopy)
 
 TEST_F (DynListSortTest, SortWithCustomComparator)
 
 TEST_F (DynListSortTest, SortMoveSemantics)
 
 TEST_F (DynListSortTest, InPlaceSortModifiesOriginal)
 
 TEST_F (DynListSortTest, InPlaceSortReturnsReference)
 
 TEST_F (DynListSortTest, SortEmptyList)
 
 TEST_F (DynListSortTest, SortSingleElement)
 
 TEST_F (DynListSortTest, SortAlreadySorted)
 
 TEST_F (DynListSortTest, SortReversed)
 
 TEST_F (DynListSortTest, SortWithDuplicates)
 
 TEST_F (DynDlistSortTest, SortReturnsSortedCopy)
 
 TEST_F (DynDlistSortTest, SortWithCustomComparator)
 
 TEST_F (DynDlistSortTest, SortMoveSemantics)
 
 TEST_F (DynDlistSortTest, InPlaceSortModifiesOriginal)
 
 TEST_F (DynArraySortTest, SortReturnsSortedCopy)
 
 TEST_F (DynArraySortTest, SortWithCustomComparator)
 
 TEST_F (DynArraySortTest, SortMoveSemantics)
 
 TEST_F (DynArraySortTest, InPlaceSortModifiesOriginal)
 
 TEST_F (DynArraySortTest, InPlaceSortReturnsReference)
 
 TEST_F (DynArraySortTest, SortEmptyArray)
 
 TEST_F (DynArraySortTest, SortSingleElement)
 
 TEST_F (ArraySortTest, SortReturnsSortedCopy)
 
 TEST_F (ArraySortTest, SortMoveSemantics)
 
 TEST_F (ArraySortTest, InPlaceSortModifiesOriginal)
 
 TEST (ListSortStability, EverySortKeepsTheOrderOfEqualItems)
 
 TEST (ListSortWithAComparisonThatThrows, TheListKeepsItsItems)
 
 TEST (StdSortTest, SortsVector)
 
 TEST (StdSortTest, SortsVectorWithCustomComparator)
 
 TEST (StdSortTest, SortsDeque)
 
 TEST (StdSortTest, SortsEmptyContainer)
 
 TEST (ArgsortTest, ArrayReturnsSortedOrderIndices)
 
 TEST (ArgsortTest, DynArrayReturnsSortedOrderIndices)
 
 TEST (ArgsortTest, StdVectorReturnsSortedOrderIndices)
 
 TEST (ArgsortTest, EmptyStdVectorReturnsEmptyIndex)
 
 TEST (ArgsortTest, CustomComparatorDescending)
 
 TEST (ArgsortTest, MatchesBuildIndexForAlephArrays)
 
 TEST (StableArgsortTest, ArrayPreservesEquivalentOrder)
 
 TEST (StableArgsortTest, DynArrayPreservesEquivalentOrder)
 
 TEST (StableArgsortTest, StdVectorPreservesEquivalentOrder)
 
 TEST (StableArgsortTest, AllEquivalentValuesPreserveOriginalOrder)
 
 TEST (StableArgsortTest, LargeDuplicateGroupsPreserveOriginalOrder)
 
 TEST (StableArgsortTest, ExhaustiveSmallInputsMatchStableSortReference)
 
 TEST (StableArgsortTest, ExhaustiveSmallInputsMatchDescendingStableSortReference)
 
 TEST (StableArgsortTest, CustomComparatorDescendingPreservesEquivalentOrder)
 
 TEST (StableArgsortTest, MatchesStableBuildIndexForAlephArrays)
 
 TEST (RanksTest, DynArrayRanks)
 
 TEST (RanksTest, ArrayRanks)
 
 TEST (RanksTest, DynListRanks)
 
 TEST (RanksTest, DynDlistRanks)
 
 TEST (RanksTest, EmptyContainer)
 
 TEST (RanksTest, SingleElement)
 
 TEST (RanksTest, AlreadySorted)
 
 TEST (RanksTest, Reversed)
 
 TEST (RanksTest, DuplicatesOrderingProperty)
 
 TEST (PairRanksTest, DynArrayPairRanks)
 
 TEST (PairRanksTest, ArrayPairRanks)
 
 TEST (PairRanksTest, DynListPairRanks)
 
 TEST (PairRanksTest, DynDlistPairRanks)
 
 TEST (MultiSortTest, BasicSort)
 
 TEST (MultiSortTest, ThreeArrays)
 
 TEST (MultiSortTest, DescendingOrder)
 
 TEST (MultiSortTest, EmptyArrays)
 
 TEST (MultiSortTest, SingleElement)
 
 TEST (MultiSortTest, StableSort)
 
 TEST (MultiSortTest, AlreadySorted)
 
 TEST (MultiSortTest, StablePropertyRandom)
 
 TEST (MultiSortTest, UnstablePropertyPermutation)
 
 TEST (MultiSortTest, ReverseSorted)
 
 TEST (MultiSortTest, SizeMismatchThrows)
 
 TEST (MultiSortTest, AlephArrays)
 
 TEST (MultiSortTest, StableFlagTrue)
 
 TEST (MultiSortTest, StableFlagFalse)
 
 TEST (MultiSortTest, StableFlagFalseWithCustomComparator)
 
 TEST (SortTraitsTest, SortIsNodiscard)
 
 TEST (SortTraitsTest, RanksIsNodiscard)
 
 TEST (SortTraitsTest, PairRanksIsNodiscard)
 
 TEST (SortStressTest, LargeDynList)
 
 TEST (SortStressTest, LargeDynArray)
 
 TEST (SortStressTest, AllSameElements)
 
 TEST (SortEdgeCaseTest, StringSort)
 
 TEST (SortEdgeCaseTest, LambdaComparator)
 

Detailed Description

Exhaustive tests for ahSort.H sorting functions.

Definition in file ahSort_test.cc.

Function Documentation

◆ TEST() [1/57]

TEST ( ArgsortTest  ,
ArrayReturnsSortedOrderIndices   
)

◆ TEST() [2/57]

TEST ( ArgsortTest  ,
CustomComparatorDescending   
)

Definition at line 709 of file ahSort_test.cc.

References Aleph::argsort().

◆ TEST() [3/57]

TEST ( ArgsortTest  ,
DynArrayReturnsSortedOrderIndices   
)

◆ TEST() [4/57]

TEST ( ArgsortTest  ,
EmptyStdVectorReturnsEmptyIndex   
)

Definition at line 700 of file ahSort_test.cc.

References Aleph::argsort().

◆ TEST() [5/57]

TEST ( ArgsortTest  ,
MatchesBuildIndexForAlephArrays   
)

◆ TEST() [6/57]

TEST ( ArgsortTest  ,
StdVectorReturnsSortedOrderIndices   
)

Definition at line 685 of file ahSort_test.cc.

References Aleph::argsort().

◆ TEST() [7/57]

TEST ( ListSortStability  ,
EverySortKeepsTheOrderOfEqualItems   
)

◆ TEST() [8/57]

TEST ( ListSortWithAComparisonThatThrows  ,
TheListKeepsItsItems   
)

Definition at line 579 of file ahSort_test.cc.

References Aleph::in_place_sort(), l, and Aleph::sort().

◆ TEST() [9/57]

TEST ( MultiSortTest  ,
AlephArrays   
)

◆ TEST() [10/57]

TEST ( MultiSortTest  ,
AlreadySorted   
)

Definition at line 1135 of file ahSort_test.cc.

References Aleph::in_place_multisort_arrays(), and keys.

◆ TEST() [11/57]

TEST ( MultiSortTest  ,
BasicSort   
)

Definition at line 1065 of file ahSort_test.cc.

References Aleph::in_place_multisort_arrays(), and keys.

◆ TEST() [12/57]

TEST ( MultiSortTest  ,
DescendingOrder   
)

Definition at line 1089 of file ahSort_test.cc.

References Aleph::in_place_multisort_arrays(), and keys.

◆ TEST() [13/57]

TEST ( MultiSortTest  ,
EmptyArrays   
)

Definition at line 1100 of file ahSort_test.cc.

References Aleph::in_place_multisort_arrays(), and keys.

◆ TEST() [14/57]

TEST ( MultiSortTest  ,
ReverseSorted   
)

Definition at line 1202 of file ahSort_test.cc.

References Aleph::in_place_multisort_arrays(), and keys.

◆ TEST() [15/57]

TEST ( MultiSortTest  ,
SingleElement   
)

Definition at line 1112 of file ahSort_test.cc.

References Aleph::in_place_multisort_arrays(), and keys.

◆ TEST() [16/57]

TEST ( MultiSortTest  ,
SizeMismatchThrows   
)

Definition at line 1213 of file ahSort_test.cc.

References Aleph::in_place_multisort_arrays(), and keys.

◆ TEST() [17/57]

TEST ( MultiSortTest  ,
StableFlagFalse   
)

Definition at line 1251 of file ahSort_test.cc.

References Aleph::in_place_multisort_arrays(), and keys.

◆ TEST() [18/57]

TEST ( MultiSortTest  ,
StableFlagFalseWithCustomComparator   
)

Definition at line 1263 of file ahSort_test.cc.

References Aleph::in_place_multisort_arrays(), and keys.

◆ TEST() [19/57]

TEST ( MultiSortTest  ,
StableFlagTrue   
)

Definition at line 1240 of file ahSort_test.cc.

References Aleph::in_place_multisort_arrays(), and keys.

◆ TEST() [20/57]

TEST ( MultiSortTest  ,
StablePropertyRandom   
)

Definition at line 1146 of file ahSort_test.cc.

References Aleph::in_place_multisort_arrays(), keys, and rng.

◆ TEST() [21/57]

TEST ( MultiSortTest  ,
StableSort   
)

Definition at line 1123 of file ahSort_test.cc.

References Aleph::in_place_multisort_arrays(), and keys.

◆ TEST() [22/57]

TEST ( MultiSortTest  ,
ThreeArrays   
)

Definition at line 1076 of file ahSort_test.cc.

References Aleph::in_place_multisort_arrays().

◆ TEST() [23/57]

TEST ( MultiSortTest  ,
UnstablePropertyPermutation   
)

Definition at line 1173 of file ahSort_test.cc.

References Aleph::in_place_multisort_arrays(), k, keys, and rng.

◆ TEST() [24/57]

TEST ( PairRanksTest  ,
ArrayPairRanks   
)

Definition at line 1020 of file ahSort_test.cc.

References Aleph::Array< T >::append(), and Aleph::pair_ranks().

◆ TEST() [25/57]

TEST ( PairRanksTest  ,
DynArrayPairRanks   
)

Definition at line 1002 of file ahSort_test.cc.

References Aleph::pair_ranks(), and Aleph::DynArray< T >::reserve().

◆ TEST() [26/57]

TEST ( PairRanksTest  ,
DynDlistPairRanks   
)

Definition at line 1048 of file ahSort_test.cc.

References Aleph::DynDlist< T >::append(), and Aleph::pair_ranks().

◆ TEST() [27/57]

TEST ( PairRanksTest  ,
DynListPairRanks   
)

Definition at line 1033 of file ahSort_test.cc.

References Aleph::DynList< T >::append(), and Aleph::pair_ranks().

◆ TEST() [28/57]

TEST ( RanksTest  ,
AlreadySorted   
)

Definition at line 941 of file ahSort_test.cc.

References r, Aleph::ranks(), and Aleph::DynArray< T >::reserve().

◆ TEST() [29/57]

TEST ( RanksTest  ,
ArrayRanks   
)

Definition at line 882 of file ahSort_test.cc.

References Aleph::Array< T >::append(), r, and Aleph::ranks().

◆ TEST() [30/57]

TEST ( RanksTest  ,
DuplicatesOrderingProperty   
)

◆ TEST() [31/57]

TEST ( RanksTest  ,
DynArrayRanks   
)

Definition at line 867 of file ahSort_test.cc.

References r, Aleph::ranks(), and Aleph::DynArray< T >::reserve().

◆ TEST() [32/57]

TEST ( RanksTest  ,
DynDlistRanks   
)

Definition at line 910 of file ahSort_test.cc.

References Aleph::DynDlist< T >::append(), r, and Aleph::ranks().

◆ TEST() [33/57]

TEST ( RanksTest  ,
DynListRanks   
)

Definition at line 896 of file ahSort_test.cc.

References Aleph::DynList< T >::append(), r, and Aleph::ranks().

◆ TEST() [34/57]

TEST ( RanksTest  ,
EmptyContainer   
)

Definition at line 924 of file ahSort_test.cc.

References r, and Aleph::ranks().

◆ TEST() [35/57]

TEST ( RanksTest  ,
Reversed   
)

Definition at line 954 of file ahSort_test.cc.

References r, Aleph::ranks(), and Aleph::DynArray< T >::reserve().

◆ TEST() [36/57]

TEST ( RanksTest  ,
SingleElement   
)

◆ TEST() [37/57]

TEST ( SortEdgeCaseTest  ,
LambdaComparator   
)

Definition at line 1361 of file ahSort_test.cc.

References Aleph::DynArray< T >::reserve(), and Aleph::sort().

◆ TEST() [38/57]

TEST ( SortEdgeCaseTest  ,
StringSort   
)

Definition at line 1348 of file ahSort_test.cc.

References Aleph::DynList< T >::append(), and Aleph::sort().

◆ TEST() [39/57]

TEST ( SortStressTest  ,
AllSameElements   
)

Definition at line 1334 of file ahSort_test.cc.

References Aleph::DynList< T >::append(), Aleph::is_sorted(), and Aleph::sort().

◆ TEST() [40/57]

TEST ( SortStressTest  ,
LargeDynArray   
)

◆ TEST() [41/57]

TEST ( SortStressTest  ,
LargeDynList   
)

Definition at line 1309 of file ahSort_test.cc.

References Aleph::DynList< T >::append(), Aleph::is_sorted(), and Aleph::sort().

◆ TEST() [42/57]

TEST ( SortTraitsTest  ,
PairRanksIsNodiscard   
)

◆ TEST() [43/57]

TEST ( SortTraitsTest  ,
RanksIsNodiscard   
)

◆ TEST() [44/57]

TEST ( SortTraitsTest  ,
SortIsNodiscard   
)

Definition at line 1278 of file ahSort_test.cc.

References Aleph::DynList< T >::append(), and Aleph::sort().

◆ TEST() [45/57]

TEST ( StableArgsortTest  ,
AllEquivalentValuesPreserveOriginalOrder   
)

Definition at line 793 of file ahSort_test.cc.

References Aleph::stable_argsort().

◆ TEST() [46/57]

TEST ( StableArgsortTest  ,
ArrayPreservesEquivalentOrder   
)

◆ TEST() [47/57]

TEST ( StableArgsortTest  ,
CustomComparatorDescendingPreservesEquivalentOrder   
)

Definition at line 831 of file ahSort_test.cc.

References Aleph::stable_argsort().

◆ TEST() [48/57]

TEST ( StableArgsortTest  ,
DynArrayPreservesEquivalentOrder   
)

◆ TEST() [49/57]

TEST ( StableArgsortTest  ,
ExhaustiveSmallInputsMatchDescendingStableSortReference   
)

Definition at line 826 of file ahSort_test.cc.

◆ TEST() [50/57]

TEST ( StableArgsortTest  ,
ExhaustiveSmallInputsMatchStableSortReference   
)

Definition at line 821 of file ahSort_test.cc.

◆ TEST() [51/57]

TEST ( StableArgsortTest  ,
LargeDuplicateGroupsPreserveOriginalOrder   
)

Definition at line 804 of file ahSort_test.cc.

References Aleph::stable_argsort().

◆ TEST() [52/57]

TEST ( StableArgsortTest  ,
MatchesStableBuildIndexForAlephArrays   
)

◆ TEST() [53/57]

TEST ( StableArgsortTest  ,
StdVectorPreservesEquivalentOrder   
)

Definition at line 779 of file ahSort_test.cc.

References Aleph::stable_argsort().

◆ TEST() [54/57]

TEST ( StdSortTest  ,
SortsDeque   
)

Definition at line 632 of file ahSort_test.cc.

References Aleph::stdsort().

◆ TEST() [55/57]

TEST ( StdSortTest  ,
SortsEmptyContainer   
)

Definition at line 639 of file ahSort_test.cc.

References Aleph::stdsort().

◆ TEST() [56/57]

TEST ( StdSortTest  ,
SortsVector   
)

Definition at line 616 of file ahSort_test.cc.

References Aleph::stdsort().

◆ TEST() [57/57]

TEST ( StdSortTest  ,
SortsVectorWithCustomComparator   
)

Definition at line 625 of file ahSort_test.cc.

References Aleph::stdsort().

◆ TEST_F() [1/24]

TEST_F ( ArraySortTest  ,
InPlaceSortModifiesOriginal   
)

Definition at line 428 of file ahSort_test.cc.

References Aleph::in_place_sort().

◆ TEST_F() [2/24]

TEST_F ( ArraySortTest  ,
SortMoveSemantics   
)

Definition at line 420 of file ahSort_test.cc.

References Aleph::build_array(), and Aleph::sort().

◆ TEST_F() [3/24]

TEST_F ( ArraySortTest  ,
SortReturnsSortedCopy   
)

Definition at line 411 of file ahSort_test.cc.

References Aleph::sort().

◆ TEST_F() [4/24]

TEST_F ( DynArraySortTest  ,
InPlaceSortModifiesOriginal   
)

Definition at line 376 of file ahSort_test.cc.

References Aleph::in_place_sort().

◆ TEST_F() [5/24]

TEST_F ( DynArraySortTest  ,
InPlaceSortReturnsReference   
)

Definition at line 384 of file ahSort_test.cc.

References Aleph::in_place_sort().

◆ TEST_F() [6/24]

TEST_F ( DynArraySortTest  ,
SortEmptyArray   
)

Definition at line 390 of file ahSort_test.cc.

References Aleph::sort().

◆ TEST_F() [7/24]

TEST_F ( DynArraySortTest  ,
SortMoveSemantics   
)

Definition at line 362 of file ahSort_test.cc.

References Aleph::build_array(), Aleph::DynArray< T >::size(), and Aleph::sort().

◆ TEST_F() [8/24]

TEST_F ( DynArraySortTest  ,
SortReturnsSortedCopy   
)

Definition at line 342 of file ahSort_test.cc.

References Aleph::sort().

◆ TEST_F() [9/24]

TEST_F ( DynArraySortTest  ,
SortSingleElement   
)

◆ TEST_F() [10/24]

TEST_F ( DynArraySortTest  ,
SortWithCustomComparator   
)

Definition at line 354 of file ahSort_test.cc.

References Aleph::sort().

◆ TEST_F() [11/24]

TEST_F ( DynDlistSortTest  ,
InPlaceSortModifiesOriginal   
)

Definition at line 332 of file ahSort_test.cc.

References Aleph::in_place_sort(), and Aleph::is_sorted().

◆ TEST_F() [12/24]

TEST_F ( DynDlistSortTest  ,
SortMoveSemantics   
)

Definition at line 324 of file ahSort_test.cc.

References Aleph::Dlink::is_empty(), Aleph::is_sorted(), and Aleph::sort().

◆ TEST_F() [13/24]

TEST_F ( DynDlistSortTest  ,
SortReturnsSortedCopy   
)

Definition at line 306 of file ahSort_test.cc.

References Aleph::is_sorted(), and Aleph::sort().

◆ TEST_F() [14/24]

TEST_F ( DynDlistSortTest  ,
SortWithCustomComparator   
)

Definition at line 313 of file ahSort_test.cc.

References Aleph::sort().

◆ TEST_F() [15/24]

TEST_F ( DynListSortTest  ,
InPlaceSortModifiesOriginal   
)

Definition at line 246 of file ahSort_test.cc.

References Aleph::in_place_sort().

◆ TEST_F() [16/24]

TEST_F ( DynListSortTest  ,
InPlaceSortReturnsReference   
)

Definition at line 258 of file ahSort_test.cc.

References Aleph::in_place_sort().

◆ TEST_F() [17/24]

TEST_F ( DynListSortTest  ,
SortAlreadySorted   
)

Definition at line 280 of file ahSort_test.cc.

References Aleph::is_sorted(), and Aleph::sort().

◆ TEST_F() [18/24]

TEST_F ( DynListSortTest  ,
SortEmptyList   
)

Definition at line 264 of file ahSort_test.cc.

References Aleph::sort().

◆ TEST_F() [19/24]

TEST_F ( DynListSortTest  ,
SortMoveSemantics   
)

Definition at line 233 of file ahSort_test.cc.

References Aleph::HTList::is_empty(), and Aleph::sort().

◆ TEST_F() [20/24]

TEST_F ( DynListSortTest  ,
SortReturnsSortedCopy   
)

Definition at line 206 of file ahSort_test.cc.

References Aleph::sort().

◆ TEST_F() [21/24]

TEST_F ( DynListSortTest  ,
SortReversed   
)

Definition at line 287 of file ahSort_test.cc.

References Aleph::is_sorted(), and Aleph::sort().

◆ TEST_F() [22/24]

TEST_F ( DynListSortTest  ,
SortSingleElement   
)

Definition at line 271 of file ahSort_test.cc.

References Aleph::DynList< T >::append(), and Aleph::sort().

◆ TEST_F() [23/24]

TEST_F ( DynListSortTest  ,
SortWithCustomComparator   
)

Definition at line 221 of file ahSort_test.cc.

References Aleph::sort().

◆ TEST_F() [24/24]

TEST_F ( DynListSortTest  ,
SortWithDuplicates   
)

Definition at line 295 of file ahSort_test.cc.

References Aleph::is_sorted(), and Aleph::sort().