| 1 | const builtin = @import("builtin"); |
| 2 | const std = @import("std"); |
| 3 | |
| 4 | const c = std.c; |
| 5 | const testing = std.testing; |
| 6 | |
| 7 | test "imaxabs" { |
| 8 | const val: c.intmax_t = -10; |
| 9 | try testing.expectEqual(10, c.imaxabs(val)); |
| 10 | } |
| 11 | |
| 12 | test "imaxdiv" { |
| 13 | if (builtin.target.cpu.arch.isPowerPC32()) return error.SkipZigTest; // TODO |
| 14 | if (builtin.target.cpu.arch == .s390x) return error.SkipZigTest; // TODO |
| 15 | |
| 16 | const expected: c.imaxdiv_t = .{ .quot = 9, .rem = 0 }; |
| 17 | try testing.expectEqual(expected, c.imaxdiv(9, 1)); |
| 18 | } |