mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 22:35:24 +00:00
std: use testing.expectEqual in math.absCast tests
This commit is contained in:
parent
488ba1560f
commit
e9c3b65bf4
@ -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.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user