mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
chore(test): clean up and add more list tests
This commit is contained in:
parent
edc066f496
commit
76c0ad1b82
1 changed files with 61 additions and 27 deletions
|
|
@ -24,33 +24,6 @@ TEST_CASE("TSList::LinkToHead", "[list]") {
|
||||||
delete node;
|
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") {
|
SECTION("links multiple nodes to head correctly") {
|
||||||
STORM_LIST(TestListNode) list;
|
STORM_LIST(TestListNode) list;
|
||||||
|
|
||||||
|
|
@ -66,4 +39,65 @@ TEST_CASE("TSList::LinkToHead", "[list]") {
|
||||||
delete node1;
|
delete node1;
|
||||||
delete node2;
|
delete node2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("links node to head after linking node to tail correctly") {
|
||||||
|
STORM_LIST(TestListNode) list;
|
||||||
|
|
||||||
|
auto node1 = new TestListNode();
|
||||||
|
list.LinkToTail(node1);
|
||||||
|
|
||||||
|
auto node2 = new TestListNode();
|
||||||
|
list.LinkToHead(node2);
|
||||||
|
|
||||||
|
REQUIRE(list.Head() == node2);
|
||||||
|
REQUIRE(list.Tail() == node1);
|
||||||
|
|
||||||
|
delete node1;
|
||||||
|
delete node2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("TSList::LinkToTail", "[list]") {
|
||||||
|
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 multiple nodes to tail correctly") {
|
||||||
|
STORM_LIST(TestListNode) list;
|
||||||
|
|
||||||
|
auto node1 = new TestListNode();
|
||||||
|
list.LinkToTail(node1);
|
||||||
|
|
||||||
|
auto node2 = new TestListNode();
|
||||||
|
list.LinkToTail(node2);
|
||||||
|
|
||||||
|
REQUIRE(list.Head() == node1);
|
||||||
|
REQUIRE(list.Tail() == node2);
|
||||||
|
|
||||||
|
delete node1;
|
||||||
|
delete node2;
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("links node to tail after linking node to head 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue