Skip to content

Commit 0170481

Browse files
committed
Correct expected/actual parameter order of some assertions
1 parent d580d52 commit 0170481

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

lib/std/mem.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3284,9 +3284,9 @@ pub fn indexOfMinMax(comptime T: type, slice: []const T) IndexOfMinMaxResult {
32843284
pub const IndexOfMinMaxResult = struct { index_min: usize, index_max: usize };
32853285

32863286
test "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

32923292
pub fn swap(comptime T: type, a: *T, b: *T) void {

lib/std/multi_array_list.zig

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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

865865
test "sorting a span" {

test/behavior/cast.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

11621162
test "implicit ptr to *anyopaque" {

test/c_abi/main.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

952952
pub 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
}
10031003
pub extern fn c_assert_CFF(lv: CFF) c_int;
10041004
pub 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
}
10501050
pub extern fn c_assert_PD(lv: PD) c_int;
10511051
pub extern fn c_assert_ret_PD() c_int;

0 commit comments

Comments
 (0)