authorgravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2020-03-05 16:02:26+11:00
committergravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2020-03-05 16:02:26+11:00
loge9c3b65bf4c7dc6c5fc07b9bcec195a5fe709db8
tree6cc1c5a5571a6a593e86220c8dd877bd5318b308
parent488ba1560fb80c1115b3b4794031859c0063ba3e
signaturelock-open Commit is signed but in an unrecognized format.

std: use testing.expectEqual in math.absCast tests


1 files changed, 5 insertions(+), 12 deletions(-)

lib/std/math.zig+5-12
...@@ -697,18 +697,11 @@ pub fn absCast(x: var) switch(@typeInfo(@TypeOf(x))) {...@@ -697,18 +697,11 @@ pub fn absCast(x: var) switch(@typeInfo(@TypeOf(x))) {
697}697}
698698
699test "math.absCast" {699test "math.absCast" {
700 testing.expect(absCast(@as(i1, -1)) == 1);700 testing.expectEqual(@as(u1, 1), absCast(@as(i1, -1)));
701701 testing.expectEqual(@as(u32, 999), absCast(@as(i32, -999)));
702 testing.expect(absCast(@as(i32, -999)) == 999);702 testing.expectEqual(@as(u32, 999), absCast(@as(i32, 999)));
703 testing.expect(@TypeOf(absCast(@as(i32, -999))) == u32);703 testing.expectEqual(@as(u32, -minInt(i32)), absCast(@as(i32, minInt(i32))));
704704 testing.expectEqual(999, absCast(-999));
705 testing.expect(absCast(@as(i32, 999)) == 999);
706 testing.expect(@TypeOf(absCast(@as(i32, 999))) == u32);
707
708 testing.expect(absCast(@as(i32, minInt(i32))) == -minInt(i32));
709 testing.expect(@TypeOf(absCast(@as(i32, minInt(i32)))) == u32);
710
711 testing.expect(absCast(-999) == 999);
712}705}
713706
714/// Returns the negation of the integer parameter.707/// Returns the negation of the integer parameter.