std: use testing.expectEqual in math.absCast tests

This commit is contained in:
daurnimator 2020-03-05 16:02:26 +11:00
parent 488ba1560f
commit e9c3b65bf4
No known key found for this signature in database
GPG Key ID: 45B429A8F9D9D22A

View File

@ -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.