|
1 | | -const builtin = @import("builtin"); |
2 | 1 | const std = @import("std"); |
3 | 2 | const assert = std.debug.assert; |
4 | 3 | const expect = std.testing.expect; |
5 | 4 | const expectEqual = std.testing.expectEqual; |
6 | 5 | const expectEqualSlices = std.testing.expectEqualSlices; |
7 | 6 | const mem = std.mem; |
8 | 7 | const maxInt = std.math.maxInt; |
| 8 | +const builtin = @import("builtin"); |
| 9 | + |
9 | 10 | const native_endian = builtin.target.cpu.arch.endian(); |
10 | 11 |
|
11 | 12 | test "int to ptr cast" { |
@@ -1867,8 +1868,8 @@ test "peer type resolution: float and comptime-known fixed-width integer" { |
1867 | 1868 |
|
1868 | 1869 | const T = @TypeOf(r1); |
1869 | 1870 |
|
1870 | | - try expectEqual(@as(T, 100.0), r1); |
1871 | | - try expectEqual(@as(T, 1.234), r2); |
| 1871 | + try expect(@as(T, 100.0) == r1); |
| 1872 | + try expect(@as(T, 1.234) == r2); |
1872 | 1873 | } |
1873 | 1874 |
|
1874 | 1875 | test "peer type resolution: same array type with sentinel" { |
@@ -2007,8 +2008,8 @@ test "peer type resolution: C pointer and @TypeOf(null)" { |
2007 | 2008 |
|
2008 | 2009 | const T = @TypeOf(r1); |
2009 | 2010 |
|
2010 | | - try expectEqual(@as(T, 0x1000), r1); |
2011 | | - try expectEqual(@as(T, null), r2); |
| 2011 | + try expect(@as(T, 0x1000) == r1); |
| 2012 | + try expect(@as(T, null) == r2); |
2012 | 2013 | } |
2013 | 2014 |
|
2014 | 2015 | test "peer type resolution: three-way resolution combines error set and optional" { |
@@ -2095,8 +2096,8 @@ test "peer type resolution: optional fixed-width int and comptime_int" { |
2095 | 2096 |
|
2096 | 2097 | const T = @TypeOf(r1); |
2097 | 2098 |
|
2098 | | - try expectEqual(@as(T, 42), r1); |
2099 | | - try expectEqual(@as(T, 50), r2); |
| 2099 | + try expect(@as(T, 42) == r1); |
| 2100 | + try expect(@as(T, 50) == r2); |
2100 | 2101 | } |
2101 | 2102 |
|
2102 | 2103 | test "peer type resolution: array and tuple" { |
@@ -2345,11 +2346,11 @@ test "peer type resolution: tuples with comptime fields" { |
2345 | 2346 | const r1 = if (t) a else b; |
2346 | 2347 | const r2 = if (t) b else a; |
2347 | 2348 |
|
2348 | | - try expectEqual(@as(u32, 1), r1[0]); |
2349 | | - try expectEqual(@as(i16, 2), r1[1]); |
| 2349 | + try expect(@as(u32, 1) == r1[0]); |
| 2350 | + try expect(@as(i16, 2) == r1[1]); |
2350 | 2351 |
|
2351 | | - try expectEqual(@as(u32, 3), r2[0]); |
2352 | | - try expectEqual(@as(i16, 4), r2[1]); |
| 2352 | + try expect(@as(u32, 3) == r2[0]); |
| 2353 | + try expect(@as(i16, 4) == r2[1]); |
2353 | 2354 | } |
2354 | 2355 |
|
2355 | 2356 | test "peer type resolution: C pointer and many pointer" { |
@@ -2742,7 +2743,7 @@ test "numeric coercions with undefined" { |
2742 | 2743 | var to: f32 = from; |
2743 | 2744 | to = @floatFromInt(from); |
2744 | 2745 | to = 42.0; |
2745 | | - try expectEqual(@as(f32, 42.0), to); |
| 2746 | + try expect(@as(f32, 42.0) == to); |
2746 | 2747 | } |
2747 | 2748 |
|
2748 | 2749 | test "15-bit int to float" { |
@@ -2824,7 +2825,7 @@ test "bitcast vector" { |
2824 | 2825 |
|
2825 | 2826 | const zerox32: u8x32 = [_]u8{0} ** 32; |
2826 | 2827 | const bigsum: u32x8 = @bitCast(zerox32); |
2827 | | - try std.testing.expectEqual(0, @reduce(.Add, bigsum)); |
| 2828 | + try std.testing.expect(0 == @reduce(.Add, bigsum)); |
2828 | 2829 | } |
2829 | 2830 |
|
2830 | 2831 | test "peer type resolution: slice of sentinel-terminated array" { |
|
0 commit comments