Added testing on the next node in the add test

main
2wenty1ne 2024-11-11 18:17:58 +01:00
parent d0904f568c
commit d69f47219f
1 changed files with 9 additions and 4 deletions

View File

@ -130,9 +130,8 @@ test "deinit()" {
_ = try testList.add(1);
_ = try testList.add(2);
testList.deinit();
}
test "add()" {
@ -143,12 +142,18 @@ test "add()" {
const firstNode = try testList.add(1);
const secondNode = try testList.add(2);
const thirdNode = try testList.add(3);
const fourtNode = try testList.add(4);
const fourthNode = try testList.add(4);
try expect(firstNode.value.* == 1);
try expect(secondNode.value.* == 2);
try expect(thirdNode.value.* == 3);
try expect(fourtNode.value.* == 4);
try expect(fourthNode.value.* == 4);
try expect(testList.first == fourthNode);
try expect(fourthNode.next == thirdNode);
try expect(thirdNode.next == secondNode);
try expect(secondNode.next == firstNode);
try expect(firstNode.next == null);
testList.deinit();