feat(list): add TSList::IsEmpty

This commit is contained in:
Adam Heinermann 2025-10-24 01:42:16 -07:00 committed by fallenoak
parent d590e2e94f
commit b52736a360
2 changed files with 26 additions and 0 deletions

View file

@ -19,6 +19,26 @@ TEST_CASE("TSList::Head", "[list]") {
}
}
TEST_CASE("TSList::IsEmpty", "[list]") {
SECTION("returns true if just initialized") {
STORM_LIST(TestListNode) list;
CHECK(list.IsEmpty());
}
SECTION("returns false if there are linked items") {
STORM_LIST(TestListNode) list;
list.NewNode(STORM_LIST_TAIL, 0, 0);
CHECK_FALSE(list.IsEmpty());
}
SECTION("returns true after clearing a populated list") {
STORM_LIST(TestListNode) list;
list.NewNode(STORM_LIST_TAIL, 0, 0);
list.Clear();
CHECK(list.IsEmpty());
}
}
TEST_CASE("TSList::LinkToHead", "[list]") {
SECTION("links node to head correctly") {
STORM_LIST(TestListNode) list;