From 85869f8225dc3f2d21fe540559e05fd1fa94d5ed Mon Sep 17 00:00:00 2001 From: Carl Ã…stholm Date: Mon, 1 Jan 2024 17:37:32 +0100 Subject: Correct expected/actual parameter order of some assertions --- lib/std/mem.zig | 6 +++--- lib/std/multi_array_list.zig | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'lib/std') diff --git a/lib/std/mem.zig b/lib/std/mem.zig index 1e9e9652a8..cee4322879 100644 --- a/lib/std/mem.zig +++ b/lib/std/mem.zig @@ -3284,9 +3284,9 @@ pub fn indexOfMinMax(comptime T: type, slice: []const T) IndexOfMinMaxResult { pub const IndexOfMinMaxResult = struct { index_min: usize, index_max: usize }; test "indexOfMinMax" { - try testing.expectEqual(indexOfMinMax(u8, "abcdefg"), IndexOfMinMaxResult{ .index_min = 0, .index_max = 6 }); - try testing.expectEqual(indexOfMinMax(u8, "gabcdef"), IndexOfMinMaxResult{ .index_min = 1, .index_max = 0 }); - try testing.expectEqual(indexOfMinMax(u8, "a"), IndexOfMinMaxResult{ .index_min = 0, .index_max = 0 }); + try testing.expectEqual(IndexOfMinMaxResult{ .index_min = 0, .index_max = 6 }, indexOfMinMax(u8, "abcdefg")); + try testing.expectEqual(IndexOfMinMaxResult{ .index_min = 1, .index_max = 0 }, indexOfMinMax(u8, "gabcdef")); + try testing.expectEqual(IndexOfMinMaxResult{ .index_min = 0, .index_max = 0 }, indexOfMinMax(u8, "a")); } pub fn swap(comptime T: type, a: *T, b: *T) void { diff --git a/lib/std/multi_array_list.zig b/lib/std/multi_array_list.zig index 7187e25f0f..6ac3ad73e2 100644 --- a/lib/std/multi_array_list.zig +++ b/lib/std/multi_array_list.zig @@ -842,24 +842,24 @@ test "union" { &.{ .a, .b, .b, .a, .a, .a, .a, .a, .a }, list.items(.tags), ); - try testing.expectEqual(list.get(0), Foo{ .a = 1 }); - try testing.expectEqual(list.get(1), Foo{ .b = "zigzag" }); - try testing.expectEqual(list.get(2), Foo{ .b = "foobar" }); - try testing.expectEqual(list.get(3), Foo{ .a = 4 }); - try testing.expectEqual(list.get(4), Foo{ .a = 5 }); - try testing.expectEqual(list.get(5), Foo{ .a = 6 }); - try testing.expectEqual(list.get(6), Foo{ .a = 7 }); - try testing.expectEqual(list.get(7), Foo{ .a = 8 }); - try testing.expectEqual(list.get(8), Foo{ .a = 9 }); + try testing.expectEqual(Foo{ .a = 1 }, list.get(0)); + try testing.expectEqual(Foo{ .b = "zigzag" }, list.get(1)); + try testing.expectEqual(Foo{ .b = "foobar" }, list.get(2)); + try testing.expectEqual(Foo{ .a = 4 }, list.get(3)); + try testing.expectEqual(Foo{ .a = 5 }, list.get(4)); + try testing.expectEqual(Foo{ .a = 6 }, list.get(5)); + try testing.expectEqual(Foo{ .a = 7 }, list.get(6)); + try testing.expectEqual(Foo{ .a = 8 }, list.get(7)); + try testing.expectEqual(Foo{ .a = 9 }, list.get(8)); list.shrinkAndFree(ally, 3); try testing.expectEqual(@as(usize, 3), list.items(.tags).len); try testing.expectEqualSlices(meta.Tag(Foo), list.items(.tags), &.{ .a, .b, .b }); - try testing.expectEqual(list.get(0), Foo{ .a = 1 }); - try testing.expectEqual(list.get(1), Foo{ .b = "zigzag" }); - try testing.expectEqual(list.get(2), Foo{ .b = "foobar" }); + try testing.expectEqual(Foo{ .a = 1 }, list.get(0)); + try testing.expectEqual(Foo{ .b = "zigzag" }, list.get(1)); + try testing.expectEqual(Foo{ .b = "foobar" }, list.get(2)); } test "sorting a span" { -- cgit v1.2.3