| ... | ... | @@ -646,31 +646,31 @@ test "math.divCeil" { |
| 646 | 646 | comptime testDivCeil(); |
| 647 | 647 | } |
| 648 | 648 | fn testDivCeil() void { |
| 649 | | testing.expectEqual(divCeil(i32, 5, 3) catch unreachable, 2); |
| 650 | | testing.expectEqual(divCeil(i32, -5, 3) catch unreachable, -1); |
| 651 | | testing.expectEqual(divCeil(i32, 5, -3) catch unreachable, -1); |
| 652 | | testing.expectEqual(divCeil(i32, -5, -3) catch unreachable, 2); |
| 653 | | testing.expectEqual(divCeil(i32, 0, 5) catch unreachable, 0); |
| 654 | | testing.expectEqual(divCeil(u32, 0, 5) catch unreachable, 0); |
| 649 | testing.expectEqual(@as(i32, 2), divCeil(i32, 5, 3) catch unreachable); |
| 650 | testing.expectEqual(@as(i32, -1), divCeil(i32, -5, 3) catch unreachable); |
| 651 | testing.expectEqual(@as(i32, -1), divCeil(i32, 5, -3) catch unreachable); |
| 652 | testing.expectEqual(@as(i32, 2), divCeil(i32, -5, -3) catch unreachable); |
| 653 | testing.expectEqual(@as(i32, 0), divCeil(i32, 0, 5) catch unreachable); |
| 654 | testing.expectEqual(@as(u32, 0), divCeil(u32, 0, 5) catch unreachable); |
| 655 | 655 | testing.expectError(error.DivisionByZero, divCeil(i8, -5, 0)); |
| 656 | 656 | testing.expectError(error.Overflow, divCeil(i8, -128, -1)); |
| 657 | 657 | |
| 658 | | testing.expectEqual(divCeil(f32, 0.0, 5.0) catch unreachable, 0.0); |
| 659 | | testing.expectEqual(divCeil(f32, 5.0, 3.0) catch unreachable, 2.0); |
| 660 | | testing.expectEqual(divCeil(f32, -5.0, 3.0) catch unreachable, -1.0); |
| 661 | | testing.expectEqual(divCeil(f32, 5.0, -3.0) catch unreachable, -1.0); |
| 662 | | testing.expectEqual(divCeil(f32, -5.0, -3.0) catch unreachable, 2.0); |
| 658 | testing.expectEqual(@as(f32, 0.0), divCeil(f32, 0.0, 5.0) catch unreachable); |
| 659 | testing.expectEqual(@as(f32, 2.0), divCeil(f32, 5.0, 3.0) catch unreachable); |
| 660 | testing.expectEqual(@as(f32, -1.0), divCeil(f32, -5.0, 3.0) catch unreachable); |
| 661 | testing.expectEqual(@as(f32, -1.0), divCeil(f32, 5.0, -3.0) catch unreachable); |
| 662 | testing.expectEqual(@as(f32, 2.0), divCeil(f32, -5.0, -3.0) catch unreachable); |
| 663 | 663 | |
| 664 | | testing.expectEqual(divCeil(comptime_int, 23, 4) catch unreachable, 6); |
| 665 | | testing.expectEqual(divCeil(comptime_int, -23, 4) catch unreachable, -5); |
| 666 | | testing.expectEqual(divCeil(comptime_int, 23, -4) catch unreachable, -5); |
| 667 | | testing.expectEqual(divCeil(comptime_int, -23, -4) catch unreachable, 6); |
| 664 | testing.expectEqual(6, divCeil(comptime_int, 23, 4) catch unreachable); |
| 665 | testing.expectEqual(-5, divCeil(comptime_int, -23, 4) catch unreachable); |
| 666 | testing.expectEqual(-5, divCeil(comptime_int, 23, -4) catch unreachable); |
| 667 | testing.expectEqual(6, divCeil(comptime_int, -23, -4) catch unreachable); |
| 668 | 668 | testing.expectError(error.DivisionByZero, divCeil(comptime_int, 23, 0)); |
| 669 | 669 | |
| 670 | | testing.expectEqual(divCeil(comptime_float, 23.0, 4.0) catch unreachable, 6.0); |
| 671 | | testing.expectEqual(divCeil(comptime_float, -23.0, 4.0) catch unreachable, -5.0); |
| 672 | | testing.expectEqual(divCeil(comptime_float, 23.0, -4.0) catch unreachable, -5.0); |
| 673 | | testing.expectEqual(divCeil(comptime_float, -23.0, -4.0) catch unreachable, 6.0); |
| 670 | testing.expectEqual(6.0, divCeil(comptime_float, 23.0, 4.0) catch unreachable); |
| 671 | testing.expectEqual(-5.0, divCeil(comptime_float, -23.0, 4.0) catch unreachable); |
| 672 | testing.expectEqual(-5.0, divCeil(comptime_float, 23.0, -4.0) catch unreachable); |
| 673 | testing.expectEqual(6.0, divCeil(comptime_float, -23.0, -4.0) catch unreachable); |
| 674 | 674 | testing.expectError(error.DivisionByZero, divCeil(comptime_float, 23.0, 0.0)); |
| 675 | 675 | } |
| 676 | 676 | |