From d69f47219ffc1cf171c3ca001300c49074bf069e Mon Sep 17 00:00:00 2001 From: 2wenty1ne Date: Mon, 11 Nov 2024 18:17:58 +0100 Subject: [PATCH] Added testing on the next node in the add test --- LList.zig | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/LList.zig b/LList.zig index aa29b9d..5e52184 100644 --- a/LList.zig +++ b/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();