mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
chore(test): add additional list tests
This commit is contained in:
parent
7c6521a547
commit
edc066f496
1 changed files with 43 additions and 0 deletions
|
|
@ -23,4 +23,47 @@ TEST_CASE("TSList::LinkToHead", "[list]") {
|
|||
|
||||
delete node;
|
||||
}
|
||||
|
||||
SECTION("links node to tail correctly") {
|
||||
STORM_LIST(TestListNode) list;
|
||||
|
||||
auto node = new TestListNode();
|
||||
list.LinkToTail(node);
|
||||
|
||||
REQUIRE(list.Tail() == node);
|
||||
|
||||
delete node;
|
||||
}
|
||||
|
||||
SECTION("links nodes to head and tail correctly") {
|
||||
STORM_LIST(TestListNode) list;
|
||||
|
||||
auto node1 = new TestListNode();
|
||||
list.LinkToHead(node1);
|
||||
|
||||
auto node2 = new TestListNode();
|
||||
list.LinkToTail(node2);
|
||||
|
||||
REQUIRE(list.Head() == node1);
|
||||
REQUIRE(list.Tail() == node2);
|
||||
|
||||
delete node1;
|
||||
delete node2;
|
||||
}
|
||||
|
||||
SECTION("links multiple nodes to head correctly") {
|
||||
STORM_LIST(TestListNode) list;
|
||||
|
||||
auto node1 = new TestListNode();
|
||||
list.LinkToHead(node1);
|
||||
|
||||
auto node2 = new TestListNode();
|
||||
list.LinkToHead(node2);
|
||||
|
||||
REQUIRE(list.Head() == node2);
|
||||
REQUIRE(list.Tail() == node1);
|
||||
|
||||
delete node1;
|
||||
delete node2;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue