authorgravatar for datamanrb@gmail.comdata-man <datamanrb@gmail.com> 2019-12-22 06:37:25+05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-12-29 18:19:03-05:00
log6af39aa49afeb3498d6c5dfa0b60a0fdc15ca47c
tree0113636e83d16e78c1c62d7f8a14c441b40ff9a3
parent6b960331ee1f688d9a6b4159e3aae48fdd0c184d

Fixes #3966


1 files changed, 15 insertions(+), 1 deletions(-)

lib/std/testing.zig+15-1
......@@ -165,7 +165,7 @@ pub fn expectEqualSlices(comptime T: type, expected: []const T, actual: []const
165165 }
166166 var i: usize = 0;
167167 while (i < expected.len) : (i += 1) {
168 if (expected[i] != actual[i]) {
168 if (!std.meta.eql(expected[i], actual[i])) {
169169 std.debug.panic("index {} incorrect. expected {}, found {}", .{ i, expected[i], actual[i] });
170170 }
171171 }
......@@ -176,3 +176,17 @@ pub fn expectEqualSlices(comptime T: type, expected: []const T, actual: []const
176176pub fn expect(ok: bool) void {
177177 if (!ok) @panic("test failure");
178178}
179
180test "expectEqual nested array" {
181 const a = [2][2]f32{
182 [_]f32{ 1.0, 0.0 },
183 [_]f32{ 0.0, 1.0 },
184 };
185
186 const b = [2][2]f32{
187 [_]f32{ 1.0, 0.0 },
188 [_]f32{ 0.0, 1.0 },
189 };
190
191 expectEqual(a, b);
192}