|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Exhaustive tests for Dlink class. More...
#include <gtest/gtest.h>#include <cstdlib>#include <vector>#include <algorithm>#include <random>#include <dlink.H>Go to the source code of this file.
Classes | |
| class | DlinkBasicTest |
| class | DlinkStackTest |
| class | DlinkInsertAppendTest |
| class | DlinkSwapTest |
| class | DlinkListOperationsTest |
| class | DlinkReverseTest |
| class | DlinkRotationTest |
| class | DlinkIteratorTest |
Functions | |
| TEST_F (DlinkBasicTest, DefaultConstructorCreatesEmptyList) | |
| TEST_F (DlinkBasicTest, CopyConstructorOfEmptyList) | |
| TEST_F (DlinkBasicTest, MoveConstructorOfEmptyList) | |
| TEST_F (DlinkBasicTest, ResetClearsNode) | |
| TEST_F (DlinkBasicTest, InitIsAliasForReset) | |
| TEST_F (DlinkStackTest, TopOnEmptyStackThrowsCorrectMessage) | |
| TEST_F (DlinkStackTest, PopOnEmptyStackThrowsCorrectMessage) | |
| TEST_F (DlinkStackTest, PushAndPopSequence) | |
| TEST_F (DlinkStackTest, AlternatingPushPop) | |
| TEST_F (DlinkInsertAppendTest, InsertOnEmptyList) | |
| TEST_F (DlinkInsertAppendTest, AppendOnEmptyList) | |
| TEST_F (DlinkInsertAppendTest, InsertMaintainsOrder) | |
| TEST_F (DlinkInsertAppendTest, AppendMaintainsOrder) | |
| TEST_F (DlinkInsertAppendTest, MixedInsertAndAppend) | |
| TEST_F (DlinkSwapTest, SwapBetweenEmptyLists) | |
| TEST_F (DlinkSwapTest, SwapEmptyWithNonEmpty) | |
| TEST_F (DlinkSwapTest, SwapNonEmptyWithEmpty) | |
| TEST_F (DlinkSwapTest, SwapBetweenNonEmptyLists) | |
| TEST_F (DlinkSwapTest, SwapWithReferenceOverload) | |
| TEST_F (DlinkListOperationsTest, ConcatListEmptyToEmpty) | |
| TEST_F (DlinkListOperationsTest, ConcatListNonEmptyToEmpty) | |
| TEST_F (DlinkListOperationsTest, ConcatListEmptyToNonEmpty) | |
| TEST_F (DlinkListOperationsTest, ConcatListBothNonEmpty) | |
| TEST_F (DlinkListOperationsTest, InsertListEmpty) | |
| TEST_F (DlinkListOperationsTest, InsertListInMiddle) | |
| TEST_F (DlinkListOperationsTest, AppendListEmpty) | |
| TEST_F (DlinkListOperationsTest, SplitEmptyList) | |
| TEST_F (DlinkListOperationsTest, SplitUnitaryList) | |
| TEST_F (DlinkListOperationsTest, SplitEvenList) | |
| TEST_F (DlinkListOperationsTest, SplitOddList) | |
| static vector< size_t > | positions_of (const Dlink &h, const vector< Dlink > &nodes) |
| TEST_F (DlinkListOperationsTest, SplitGivesTheFirstHalfToTheLeft) | |
| TEST_F (DlinkListOperationsTest, CutListAtFirst) | |
| TEST_F (DlinkListOperationsTest, CutListAtLast) | |
| TEST_F (DlinkListOperationsTest, CutListInMiddle) | |
| TEST_F (DlinkReverseTest, ReverseEmptyList) | |
| TEST_F (DlinkReverseTest, ReverseUnitaryList) | |
| TEST_F (DlinkReverseTest, ReverseTwoElements) | |
| TEST_F (DlinkReverseTest, ReverseMultipleElements) | |
| TEST_F (DlinkReverseTest, DoubleReverseRestoresOrder) | |
| TEST_F (DlinkRotationTest, RotateLeftZero) | |
| TEST_F (DlinkRotationTest, RotateLeftOne) | |
| TEST_F (DlinkRotationTest, RotateLeftFullCycle) | |
| TEST_F (DlinkRotationTest, RotateRightOne) | |
| TEST_F (DlinkRotationTest, RotateEmptyListThrows) | |
| TEST_F (DlinkIteratorTest, IteratorOnEmptyList) | |
| TEST_F (DlinkIteratorTest, IteratorForwardTraversal) | |
| TEST_F (DlinkIteratorTest, IteratorBackwardTraversal) | |
| TEST_F (DlinkIteratorTest, IteratorDeleteAllElements) | |
| TEST_F (DlinkIteratorTest, IteratorDeleteMiddleElement) | |
| TEST_F (DlinkIteratorTest, DelNeRemovesTheCurrentNodeAndMovesForward) | |
| TEST (DlinkIteratorDeathTest, DelNeAssertsThatThereIsACurrentNode) | |
| TEST_F (DlinkIteratorTest, IteratorIsFirstAndIsLast) | |
| TEST_F (DlinkIteratorTest, IteratorEqualityOperators) | |
| TEST (DlinkConsistency, CheckEmptyList) | |
| TEST (DlinkConsistency, CheckAfterOperations) | |
| TEST (DlinkStress, LargeListOperations) | |
| TEST (DlinkStress, RandomOperations) | |
| TEST (DlinkMoveSemantics, MoveConstructor) | |
| TEST (DlinkMoveSemantics, MoveAssignment) | |
| TEST (DlinkEdgeCases, SelfSwap) | |
| TEST (DlinkEdgeCases, RemoveOnlyElement) | |
| TEST (DlinkEdgeCases, IteratorOnUnitaryList) | |
| TEST (DlinkStress, MassiveListOperations) | |
| TEST (DlinkStress, RepeatedSplitConcat) | |
| TEST (DlinkFuzz, RandomInsertRemoveOperations) | |
| TEST (DlinkStress, RotationStress) | |
| TEST (DlinkStress, IteratorDeletionUnderStress) | |
Exhaustive tests for Dlink class.
These tests cover all operations of Dlink including edge cases and the bug fixes made to the class.
Definition in file dlink_test.cc.
Definition at line 508 of file dlink_test.cc.
References Aleph::and, Aleph::Dlink::get_next(), h, nodes, and out.
Referenced by TEST_F().
| TEST | ( | DlinkConsistency | , |
| CheckAfterOperations | |||
| ) |
Definition at line 907 of file dlink_test.cc.
References Aleph::Dlink::append(), Aleph::Dlink::check(), l, nodes, r, Aleph::Dlink::reverse_list(), Aleph::Dlink::rotate_left(), and Aleph::Dlink::split_list().
| TEST | ( | DlinkConsistency | , |
| CheckEmptyList | |||
| ) |
Definition at line 901 of file dlink_test.cc.
References Aleph::Dlink::check().
| TEST | ( | DlinkEdgeCases | , |
| IteratorOnUnitaryList | |||
| ) |
Definition at line 1098 of file dlink_test.cc.
References Aleph::Dlink::append(), Aleph::Dlink::Iterator::get_curr(), Aleph::Dlink::Iterator::has_curr(), Aleph::Dlink::Iterator::is_in_first(), Aleph::Dlink::Iterator::is_last(), and Aleph::Dlink::Iterator::next().
| TEST | ( | DlinkEdgeCases | , |
| RemoveOnlyElement | |||
| ) |
Definition at line 1085 of file dlink_test.cc.
References Aleph::Dlink::append(), Aleph::Dlink::is_empty(), Aleph::Dlink::is_unitarian(), and Aleph::Dlink::remove_first().
| TEST | ( | DlinkEdgeCases | , |
| SelfSwap | |||
| ) |
Definition at line 1070 of file dlink_test.cc.
References Aleph::Dlink::append(), Aleph::Dlink::get_first(), Aleph::Dlink::get_last(), Aleph::Dlink::is_empty(), and Aleph::Dlink::swap().
| TEST | ( | DlinkFuzz | , |
| RandomInsertRemoveOperations | |||
| ) |
Definition at line 1190 of file dlink_test.cc.
References Aleph::Dlink::append(), Aleph::Dlink::check(), Aleph::Dlink::Iterator::has_curr(), Aleph::Dlink::insert(), Aleph::Dlink::is_empty(), N, nodes, Aleph::Dlink::remove_first(), Aleph::Dlink::remove_last(), Aleph::Dlink::reverse_list(), and rng.
| TEST | ( | DlinkIteratorDeathTest | , |
| DelNeAssertsThatThereIsACurrentNode | |||
| ) |
Definition at line 836 of file dlink_test.cc.
References Aleph::Dlink::append(), Aleph::Dlink::Iterator::del_ne(), and Aleph::Dlink::Iterator::next_ne().
| TEST | ( | DlinkMoveSemantics | , |
| MoveAssignment | |||
| ) |
Definition at line 1050 of file dlink_test.cc.
References Aleph::Dlink::append(), Aleph::Dlink::get_first(), Aleph::Dlink::get_last(), and Aleph::Dlink::is_empty().
| TEST | ( | DlinkMoveSemantics | , |
| MoveConstructor | |||
| ) |
Definition at line 1034 of file dlink_test.cc.
References Aleph::Dlink::append(), Aleph::Dlink::get_first(), Aleph::Dlink::get_last(), and Aleph::Dlink::is_empty().
| TEST | ( | DlinkStress | , |
| IteratorDeletionUnderStress | |||
| ) |
Definition at line 1302 of file dlink_test.cc.
References Aleph::Dlink::append(), Aleph::Dlink::check(), Aleph::count(), Aleph::Dlink::Iterator::del(), Aleph::Dlink::Iterator::has_curr(), N, Aleph::Dlink::Iterator::next(), and nodes.
| TEST | ( | DlinkStress | , |
| LargeListOperations | |||
| ) |
Definition at line 933 of file dlink_test.cc.
References Aleph::Dlink::append(), Aleph::Dlink::check(), Aleph::DynList< T >::concat_list(), Aleph::count(), Aleph::Dlink::is_empty(), l, N, nodes, r, Aleph::Dlink::reverse_list(), and Aleph::Dlink::split_list().
| TEST | ( | DlinkStress | , |
| MassiveListOperations | |||
| ) |
Definition at line 1118 of file dlink_test.cc.
References Aleph::Dlink::append(), Aleph::Dlink::check(), Aleph::count(), Aleph::Dlink::get_first(), Aleph::Dlink::get_last(), Aleph::Dlink::Iterator::has_curr(), Aleph::Dlink::is_empty(), N, nodes, Aleph::Dlink::remove_first(), and Aleph::Dlink::reverse_list().
| TEST | ( | DlinkStress | , |
| RandomOperations | |||
| ) |
Definition at line 962 of file dlink_test.cc.
References Aleph::Dlink::append(), Aleph::Dlink::check(), Aleph::Dlink::insert(), Aleph::Dlink::is_empty(), N, nodes, Aleph::Dlink::remove_first(), Aleph::Dlink::remove_last(), and rng.
| TEST | ( | DlinkStress | , |
| RepeatedSplitConcat | |||
| ) |
Definition at line 1152 of file dlink_test.cc.
References Aleph::Dlink::append(), Aleph::Dlink::check(), Aleph::DynList< T >::concat_list(), Aleph::Dlink::is_empty(), l, N, nodes, r, rng, Aleph::Dlink::split_list(), and Aleph::Dlink::swap().
| TEST | ( | DlinkStress | , |
| RotationStress | |||
| ) |
Definition at line 1277 of file dlink_test.cc.
References Aleph::Dlink::append(), Aleph::Dlink::check(), N, nodes, Aleph::Dlink::rotate_left(), and Aleph::Dlink::rotate_right().
| TEST_F | ( | DlinkBasicTest | , |
| CopyConstructorOfEmptyList | |||
| ) |
Definition at line 71 of file dlink_test.cc.
References Aleph::copy().
| TEST_F | ( | DlinkBasicTest | , |
| DefaultConstructorCreatesEmptyList | |||
| ) |
Definition at line 62 of file dlink_test.cc.
| TEST_F | ( | DlinkBasicTest | , |
| InitIsAliasForReset | |||
| ) |
Definition at line 95 of file dlink_test.cc.
References Aleph::Dlink::get_next(), Aleph::Dlink::get_prev(), Aleph::Dlink::init(), and Aleph::Dlink::is_empty().
| TEST_F | ( | DlinkBasicTest | , |
| MoveConstructorOfEmptyList | |||
| ) |
Definition at line 79 of file dlink_test.cc.
References Aleph::Dlink::is_empty().
| TEST_F | ( | DlinkBasicTest | , |
| ResetClearsNode | |||
| ) |
Definition at line 86 of file dlink_test.cc.
References Aleph::Dlink::get_next(), Aleph::Dlink::get_prev(), Aleph::Dlink::is_empty(), and Aleph::Dlink::reset().
| TEST_F | ( | DlinkInsertAppendTest | , |
| AppendMaintainsOrder | |||
| ) |
Definition at line 239 of file dlink_test.cc.
References Aleph::Dlink::Iterator::get_curr(), Aleph::Dlink::Iterator::next(), and nodes.
| TEST_F | ( | DlinkInsertAppendTest | , |
| AppendOnEmptyList | |||
| ) |
Definition at line 218 of file dlink_test.cc.
References nodes.
| TEST_F | ( | DlinkInsertAppendTest | , |
| InsertMaintainsOrder | |||
| ) |
Definition at line 227 of file dlink_test.cc.
References Aleph::Dlink::Iterator::get_curr(), Aleph::Dlink::Iterator::next(), and nodes.
| TEST_F | ( | DlinkInsertAppendTest | , |
| InsertOnEmptyList | |||
| ) |
Definition at line 209 of file dlink_test.cc.
References nodes.
| TEST_F | ( | DlinkInsertAppendTest | , |
| MixedInsertAndAppend | |||
| ) |
Definition at line 251 of file dlink_test.cc.
References Aleph::Dlink::Iterator::get_curr(), Aleph::Dlink::Iterator::next(), and nodes.
| TEST_F | ( | DlinkIteratorTest | , |
| DelNeRemovesTheCurrentNodeAndMovesForward | |||
| ) |
Definition at line 810 of file dlink_test.cc.
References Aleph::and, Aleph::Dlink::Iterator::del_ne(), Aleph::Dlink::Iterator::get_curr_ne(), Aleph::Dlink::Iterator::has_curr(), Aleph::Dlink::Iterator::next_ne(), and nodes.
| TEST_F | ( | DlinkIteratorTest | , |
| IteratorBackwardTraversal | |||
| ) |
Definition at line 763 of file dlink_test.cc.
References Aleph::count(), Aleph::Dlink::Iterator::get_curr(), Aleph::Dlink::Iterator::has_curr(), nodes, Aleph::Dlink::Iterator::prev(), and Aleph::Dlink::Iterator::reset_last().
| TEST_F | ( | DlinkIteratorTest | , |
| IteratorDeleteAllElements | |||
| ) |
Definition at line 781 of file dlink_test.cc.
References Aleph::Dlink::Iterator::del(), Aleph::Dlink::Iterator::has_curr(), and nodes.
| TEST_F | ( | DlinkIteratorTest | , |
| IteratorDeleteMiddleElement | |||
| ) |
Definition at line 793 of file dlink_test.cc.
References Aleph::Dlink::Iterator::del(), Aleph::Dlink::Iterator::get_curr(), Aleph::Dlink::Iterator::has_curr(), Aleph::Dlink::Iterator::next(), and nodes.
| TEST_F | ( | DlinkIteratorTest | , |
| IteratorEqualityOperators | |||
| ) |
Definition at line 881 of file dlink_test.cc.
References Aleph::Dlink::Iterator::next(), and nodes.
| TEST_F | ( | DlinkIteratorTest | , |
| IteratorForwardTraversal | |||
| ) |
Definition at line 751 of file dlink_test.cc.
References Aleph::count(), Aleph::Dlink::Iterator::has_curr(), and nodes.
| TEST_F | ( | DlinkIteratorTest | , |
| IteratorIsFirstAndIsLast | |||
| ) |
Definition at line 863 of file dlink_test.cc.
References Aleph::Dlink::Iterator::is_in_first(), Aleph::Dlink::Iterator::is_last(), Aleph::Dlink::Iterator::next(), and nodes.
| TEST_F | ( | DlinkIteratorTest | , |
| IteratorOnEmptyList | |||
| ) |
Definition at line 742 of file dlink_test.cc.
References Aleph::Dlink::Iterator::get_curr(), Aleph::Dlink::Iterator::has_curr(), Aleph::Dlink::Iterator::next(), and Aleph::Dlink::Iterator::prev().
| TEST_F | ( | DlinkListOperationsTest | , |
| AppendListEmpty | |||
| ) |
Definition at line 447 of file dlink_test.cc.
References nodes.
| TEST_F | ( | DlinkListOperationsTest | , |
| ConcatListBothNonEmpty | |||
| ) |
Definition at line 395 of file dlink_test.cc.
References Aleph::Dlink::Iterator::get_curr(), Aleph::Dlink::Iterator::next(), and nodes.
| TEST_F | ( | DlinkListOperationsTest | , |
| ConcatListEmptyToEmpty | |||
| ) |
Definition at line 364 of file dlink_test.cc.
| TEST_F | ( | DlinkListOperationsTest | , |
| ConcatListEmptyToNonEmpty | |||
| ) |
Definition at line 383 of file dlink_test.cc.
References nodes.
| TEST_F | ( | DlinkListOperationsTest | , |
| ConcatListNonEmptyToEmpty | |||
| ) |
Definition at line 371 of file dlink_test.cc.
References nodes.
| TEST_F | ( | DlinkListOperationsTest | , |
| CutListAtFirst | |||
| ) |
Definition at line 547 of file dlink_test.cc.
References Aleph::Dlink::cut_list(), Aleph::Dlink::get_first(), Aleph::Dlink::get_last(), and nodes.
| TEST_F | ( | DlinkListOperationsTest | , |
| CutListAtLast | |||
| ) |
Definition at line 558 of file dlink_test.cc.
References Aleph::Dlink::cut_list(), Aleph::Dlink::get_first(), Aleph::Dlink::is_unitarian(), and nodes.
| TEST_F | ( | DlinkListOperationsTest | , |
| CutListInMiddle | |||
| ) |
Definition at line 571 of file dlink_test.cc.
References Aleph::Dlink::cut_list(), Aleph::Dlink::get_first(), Aleph::Dlink::get_last(), and nodes.
| TEST_F | ( | DlinkListOperationsTest | , |
| InsertListEmpty | |||
| ) |
Definition at line 412 of file dlink_test.cc.
References nodes.
| TEST_F | ( | DlinkListOperationsTest | , |
| InsertListInMiddle | |||
| ) |
Definition at line 423 of file dlink_test.cc.
References Aleph::Dlink::Iterator::get_curr(), Aleph::Dlink::Iterator::next(), and nodes.
| TEST_F | ( | DlinkListOperationsTest | , |
| SplitEmptyList | |||
| ) |
Definition at line 458 of file dlink_test.cc.
References Aleph::count(), Aleph::HTList::is_empty(), l, and r.
| TEST_F | ( | DlinkListOperationsTest | , |
| SplitEvenList | |||
| ) |
Definition at line 481 of file dlink_test.cc.
References Aleph::count(), Aleph::HTList::is_empty(), l, and r.
| TEST_F | ( | DlinkListOperationsTest | , |
| SplitGivesTheFirstHalfToTheLeft | |||
| ) |
Definition at line 524 of file dlink_test.cc.
References Aleph::Dlink::append(), Aleph::Dlink::get_prev(), Aleph::Dlink::is_empty(), l, nodes, positions_of(), r, and Aleph::Dlink::split_list().
| TEST_F | ( | DlinkListOperationsTest | , |
| SplitOddList | |||
| ) |
Definition at line 494 of file dlink_test.cc.
References Aleph::count(), l, and r.
| TEST_F | ( | DlinkListOperationsTest | , |
| SplitUnitaryList | |||
| ) |
Definition at line 468 of file dlink_test.cc.
References Aleph::count(), Aleph::HTList::is_empty(), l, nodes, and r.
| TEST_F | ( | DlinkReverseTest | , |
| DoubleReverseRestoresOrder | |||
| ) |
Definition at line 642 of file dlink_test.cc.
References Aleph::Dlink::Iterator::get_curr(), Aleph::Dlink::Iterator::next(), and nodes.
| TEST_F | ( | DlinkReverseTest | , |
| ReverseEmptyList | |||
| ) |
Definition at line 599 of file dlink_test.cc.
References Aleph::count().
| TEST_F | ( | DlinkReverseTest | , |
| ReverseMultipleElements | |||
| ) |
Definition at line 625 of file dlink_test.cc.
References Aleph::count(), Aleph::Dlink::Iterator::get_curr(), Aleph::Dlink::Iterator::next(), and nodes.
| TEST_F | ( | DlinkReverseTest | , |
| ReverseTwoElements | |||
| ) |
Definition at line 614 of file dlink_test.cc.
References nodes.
| TEST_F | ( | DlinkReverseTest | , |
| ReverseUnitaryList | |||
| ) |
Definition at line 606 of file dlink_test.cc.
References Aleph::count(), and nodes.
| TEST_F | ( | DlinkRotationTest | , |
| RotateEmptyListThrows | |||
| ) |
Definition at line 717 of file dlink_test.cc.
References Aleph::Dlink::rotate_left(), and Aleph::Dlink::rotate_right().
| TEST_F | ( | DlinkRotationTest | , |
| RotateLeftFullCycle | |||
| ) |
Definition at line 698 of file dlink_test.cc.
References Aleph::Dlink::Iterator::get_curr(), Aleph::Dlink::Iterator::next(), and nodes.
| TEST_F | ( | DlinkRotationTest | , |
| RotateLeftOne | |||
| ) |
Definition at line 682 of file dlink_test.cc.
References Aleph::Dlink::Iterator::get_curr(), Aleph::Dlink::Iterator::next(), and nodes.
| TEST_F | ( | DlinkRotationTest | , |
| RotateLeftZero | |||
| ) |
Definition at line 673 of file dlink_test.cc.
References Aleph::Dlink::Iterator::get_curr(), Aleph::Dlink::Iterator::next(), and nodes.
| TEST_F | ( | DlinkRotationTest | , |
| RotateRightOne | |||
| ) |
Definition at line 707 of file dlink_test.cc.
References Aleph::Dlink::Iterator::get_curr(), Aleph::Dlink::Iterator::next(), and nodes.
| TEST_F | ( | DlinkStackTest | , |
| AlternatingPushPop | |||
| ) |
Definition at line 177 of file dlink_test.cc.
| TEST_F | ( | DlinkStackTest | , |
| PopOnEmptyStackThrowsCorrectMessage | |||
| ) |
Definition at line 134 of file dlink_test.cc.
References FAIL.
| TEST_F | ( | DlinkStackTest | , |
| PushAndPopSequence | |||
| ) |
Definition at line 153 of file dlink_test.cc.
| TEST_F | ( | DlinkStackTest | , |
| TopOnEmptyStackThrowsCorrectMessage | |||
| ) |
Definition at line 115 of file dlink_test.cc.
References FAIL.
| TEST_F | ( | DlinkSwapTest | , |
| SwapBetweenEmptyLists | |||
| ) |
Definition at line 279 of file dlink_test.cc.
References Aleph::Dlink::swap().
| TEST_F | ( | DlinkSwapTest | , |
| SwapBetweenNonEmptyLists | |||
| ) |
Definition at line 313 of file dlink_test.cc.
| TEST_F | ( | DlinkSwapTest | , |
| SwapEmptyWithNonEmpty | |||
| ) |
Definition at line 286 of file dlink_test.cc.
| TEST_F | ( | DlinkSwapTest | , |
| SwapNonEmptyWithEmpty | |||
| ) |
Definition at line 300 of file dlink_test.cc.
| TEST_F | ( | DlinkSwapTest | , |
| SwapWithReferenceOverload | |||
| ) |
Definition at line 331 of file dlink_test.cc.