feat(list): add list templates

This commit is contained in:
fallenoak 2020-09-16 01:28:32 -05:00
parent 7713223e60
commit ced42bbfed
No known key found for this signature in database
GPG key ID: 7628F8E61AEA070D
8 changed files with 434 additions and 0 deletions

26
test/List.cpp Normal file
View 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);
}
}