authorgravatar for carl@astholm.seCarl Åstholm <carl@astholm.se> 2024-01-01 17:37:32+01:00
committergravatar for carl@astholm.seCarl Åstholm <carl@astholm.se> 2024-01-03 21:20:49+01:00
log85869f8225dc3f2d21fe540559e05fd1fa94d5ed
treea5361265787cff9414bd7aea5e5d75d0b9060b47
parentd7b36503cad1de60cd0b6a115ef7ac336a03a09a

Correct expected/actual parameter order of some assertions


4 files changed, 19 insertions(+), 19 deletions(-)

lib/std/mem.zig+3-3
......@@ -3284,9 +3284,9 @@ pub fn indexOfMinMax(comptime T: type, slice: []const T) IndexOfMinMaxResult {
32843284pub const IndexOfMinMaxResult = struct { index_min: usize, index_max: usize };
32853285
32863286test "indexOfMinMax" {
3287 try testing.expectEqual(indexOfMinMax(u8, "abcdefg"), IndexOfMinMaxResult{ .index_min = 0, .index_max = 6 });
3288 try testing.expectEqual(indexOfMinMax(u8, "gabcdef"), IndexOfMinMaxResult{ .index_min = 1, .index_max = 0 });
3289 try testing.expectEqual(indexOfMinMax(u8, "a"), IndexOfMinMaxResult{ .index_min = 0, .index_max = 0 });
3287 try testing.expectEqual(IndexOfMinMaxResult{ .index_min = 0, .index_max = 6 }, indexOfMinMax(u8, "abcdefg"));
3288 try testing.expectEqual(IndexOfMinMaxResult{ .index_min = 1, .index_max = 0 }, indexOfMinMax(u8, "gabcdef"));
3289 try testing.expectEqual(IndexOfMinMaxResult{ .index_min = 0, .index_max = 0 }, indexOfMinMax(u8, "a"));
32903290}
32913291
32923292pub fn swap(comptime T: type, a: *T, b: *T) void {
lib/std/multi_array_list.zig+12-12
......@@ -842,24 +842,24 @@ test "union" {
842842 &.{ .a, .b, .b, .a, .a, .a, .a, .a, .a },
843843 list.items(.tags),
844844 );
845 try testing.expectEqual(list.get(0), Foo{ .a = 1 });
846 try testing.expectEqual(list.get(1), Foo{ .b = "zigzag" });
847 try testing.expectEqual(list.get(2), Foo{ .b = "foobar" });
848 try testing.expectEqual(list.get(3), Foo{ .a = 4 });
849 try testing.expectEqual(list.get(4), Foo{ .a = 5 });
850 try testing.expectEqual(list.get(5), Foo{ .a = 6 });
851 try testing.expectEqual(list.get(6), Foo{ .a = 7 });
852 try testing.expectEqual(list.get(7), Foo{ .a = 8 });
853 try testing.expectEqual(list.get(8), Foo{ .a = 9 });
845 try testing.expectEqual(Foo{ .a = 1 }, list.get(0));
846 try testing.expectEqual(Foo{ .b = "zigzag" }, list.get(1));
847 try testing.expectEqual(Foo{ .b = "foobar" }, list.get(2));
848 try testing.expectEqual(Foo{ .a = 4 }, list.get(3));
849 try testing.expectEqual(Foo{ .a = 5 }, list.get(4));
850 try testing.expectEqual(Foo{ .a = 6 }, list.get(5));
851 try testing.expectEqual(Foo{ .a = 7 }, list.get(6));
852 try testing.expectEqual(Foo{ .a = 8 }, list.get(7));
853 try testing.expectEqual(Foo{ .a = 9 }, list.get(8));
854854
855855 list.shrinkAndFree(ally, 3);
856856
857857 try testing.expectEqual(@as(usize, 3), list.items(.tags).len);
858858 try testing.expectEqualSlices(meta.Tag(Foo), list.items(.tags), &.{ .a, .b, .b });
859859
860 try testing.expectEqual(list.get(0), Foo{ .a = 1 });
861 try testing.expectEqual(list.get(1), Foo{ .b = "zigzag" });
862 try testing.expectEqual(list.get(2), Foo{ .b = "foobar" });
860 try testing.expectEqual(Foo{ .a = 1 }, list.get(0));
861 try testing.expectEqual(Foo{ .b = "zigzag" }, list.get(1));
862 try testing.expectEqual(Foo{ .b = "foobar" }, list.get(2));
863863}
864864
865865test "sorting a span" {
test/behavior/cast.zig+1-1
......@@ -1156,7 +1156,7 @@ test "cast function with an opaque parameter" {
11561156 .func = @ptrCast(&Foo.funcImpl),
11571157 };
11581158 c.func(c.ctx);
1159 try std.testing.expectEqual(foo, Foo{ .x = 101, .y = 201 });
1159 try std.testing.expectEqual(Foo{ .x = 101, .y = 201 }, foo);
11601160}
11611161
11621162test "implicit ptr to *anyopaque" {
test/c_abi/main.zig+3-3
......@@ -946,7 +946,7 @@ test "DC: C returns to Zig" {
946946 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
947947 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
948948 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
949 try expectEqual(c_ret_DC(), DC{ .v1 = -0.25, .v2 = 15 });
949 try expectEqual(DC{ .v1 = -0.25, .v2 = 15 }, c_ret_DC());
950950}
951951
952952pub extern fn c_assert_DC(lv: DC) c_int;
......@@ -998,7 +998,7 @@ test "CFF: C returns to Zig" {
998998 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
999999 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
10001000 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
1001 try expectEqual(c_ret_CFF(), CFF{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 });
1001 try expectEqual(CFF{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 }, c_ret_CFF());
10021002}
10031003pub extern fn c_assert_CFF(lv: CFF) c_int;
10041004pub extern fn c_assert_ret_CFF() c_int;
......@@ -1045,7 +1045,7 @@ test "PD: C returns to Zig" {
10451045 if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest;
10461046 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
10471047 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
1048 try expectEqual(c_ret_PD(), PD{ .v1 = null, .v2 = 0.5 });
1048 try expectEqual(PD{ .v1 = null, .v2 = 0.5 }, c_ret_PD());
10491049}
10501050pub extern fn c_assert_PD(lv: PD) c_int;
10511051pub extern fn c_assert_ret_PD() c_int;