Added testing on the next node in the add test
parent
d0904f568c
commit
d69f47219f
13
LList.zig
13
LList.zig
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue