From e9c3b65bf4c7dc6c5fc07b9bcec195a5fe709db8 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Thu, 5 Mar 2020 16:02:26 +1100 Subject: [PATCH] std: use testing.expectEqual in math.absCast tests --- lib/std/math.zig | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/lib/std/math.zig b/lib/std/math.zig index a411b58fac..ed13e3cd27 100644 --- a/lib/std/math.zig +++ b/lib/std/math.zig @@ -697,18 +697,11 @@ pub fn absCast(x: var) switch(@typeInfo(@TypeOf(x))) { } test "math.absCast" { - testing.expect(absCast(@as(i1, -1)) == 1); - - testing.expect(absCast(@as(i32, -999)) == 999); - testing.expect(@TypeOf(absCast(@as(i32, -999))) == u32); - - testing.expect(absCast(@as(i32, 999)) == 999); - testing.expect(@TypeOf(absCast(@as(i32, 999))) == u32); - - testing.expect(absCast(@as(i32, minInt(i32))) == -minInt(i32)); - testing.expect(@TypeOf(absCast(@as(i32, minInt(i32)))) == u32); - - testing.expect(absCast(-999) == 999); + testing.expectEqual(@as(u1, 1), absCast(@as(i1, -1))); + testing.expectEqual(@as(u32, 999), absCast(@as(i32, -999))); + testing.expectEqual(@as(u32, 999), absCast(@as(i32, 999))); + testing.expectEqual(@as(u32, -minInt(i32)), absCast(@as(i32, minInt(i32)))); + testing.expectEqual(999, absCast(-999)); } /// Returns the negation of the integer parameter.