mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 06:45:24 +00:00
Fixes #3966
This commit is contained in:
parent
6b960331ee
commit
6af39aa49a
@ -165,7 +165,7 @@ pub fn expectEqualSlices(comptime T: type, expected: []const T, actual: []const
|
||||
}
|
||||
var i: usize = 0;
|
||||
while (i < expected.len) : (i += 1) {
|
||||
if (expected[i] != actual[i]) {
|
||||
if (!std.meta.eql(expected[i], actual[i])) {
|
||||
std.debug.panic("index {} incorrect. expected {}, found {}", .{ i, expected[i], actual[i] });
|
||||
}
|
||||
}
|
||||
@ -176,3 +176,17 @@ pub fn expectEqualSlices(comptime T: type, expected: []const T, actual: []const
|
||||
pub fn expect(ok: bool) void {
|
||||
if (!ok) @panic("test failure");
|
||||
}
|
||||
|
||||
test "expectEqual nested array" {
|
||||
const a = [2][2]f32{
|
||||
[_]f32{ 1.0, 0.0 },
|
||||
[_]f32{ 0.0, 1.0 },
|
||||
};
|
||||
|
||||
const b = [2][2]f32{
|
||||
[_]f32{ 1.0, 0.0 },
|
||||
[_]f32{ 0.0, 1.0 },
|
||||
};
|
||||
|
||||
expectEqual(a, b);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user