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" { diff --git a/test/behavior/cast.zig b/test/behavior/cast.zig index 10f3e80e21..d7f347c800 100644 --- a/test/behavior/cast.zig +++ b/test/behavior/cast.zig @@ -1156,7 +1156,7 @@ test "cast function with an opaque parameter" { .func = @ptrCast(&Foo.funcImpl), }; c.func(c.ctx); - try std.testing.expectEqual(foo, Foo{ .x = 101, .y = 201 }); + try std.testing.expectEqual(Foo{ .x = 101, .y = 201 }, foo); } test "implicit ptr to *anyopaque" { diff --git a/test/c_abi/main.zig b/test/c_abi/main.zig index 919d2c9083..90bfe174ca 100644 --- a/test/c_abi/main.zig +++ b/test/c_abi/main.zig @@ -946,7 +946,7 @@ test "DC: C returns to Zig" { if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; - try expectEqual(c_ret_DC(), DC{ .v1 = -0.25, .v2 = 15 }); + try expectEqual(DC{ .v1 = -0.25, .v2 = 15 }, c_ret_DC()); } pub extern fn c_assert_DC(lv: DC) c_int; @@ -998,7 +998,7 @@ test "CFF: C returns to Zig" { if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; - try expectEqual(c_ret_CFF(), CFF{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 }); + try expectEqual(CFF{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 }, c_ret_CFF()); } pub extern fn c_assert_CFF(lv: CFF) c_int; pub extern fn c_assert_ret_CFF() c_int; @@ -1045,7 +1045,7 @@ test "PD: C returns to Zig" { if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest; if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; - try expectEqual(c_ret_PD(), PD{ .v1 = null, .v2 = 0.5 }); + try expectEqual(PD{ .v1 = null, .v2 = 0.5 }, c_ret_PD()); } pub extern fn c_assert_PD(lv: PD) c_int; pub extern fn c_assert_ret_PD() c_int;