mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 10:32:29 +00:00
feat(list): add list templates
This commit is contained in:
parent
7713223e60
commit
ced42bbfed
8 changed files with 434 additions and 0 deletions
26
test/List.cpp
Normal file
26
test/List.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#include "Test.hpp"
|
||||
#include "List.hpp"
|
||||
|
||||
struct TestListNode : TSLinkedNode<TestListNode> {
|
||||
uint32_t index = 0;
|
||||
};
|
||||
|
||||
TEST_CASE("TSList", "[list]") {
|
||||
SECTION("constructs correctly") {
|
||||
STORM_LIST(TestListNode) list;
|
||||
REQUIRE(list.Head() == nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("TSList::LinkToHead", "[list]") {
|
||||
SECTION("links node to head correctly") {
|
||||
STORM_LIST(TestListNode) list;
|
||||
|
||||
auto node = new TestListNode();
|
||||
list.LinkToHead(node);
|
||||
|
||||
REQUIRE(list.Head() == node);
|
||||
|
||||
delete(node);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue