| author | |
| committer | |
| log | 6612e7cdb26a761392f129525872bd00758095c2 |
| tree | 3b9cd080c9867109d0ced8dc5731fb61fb331d59 |
| parent | 7ea8f842bc65cdaf046483b2bfe7948ebad16516 |
| signature |
7 files changed, 47 insertions(+), 0 deletions(-)
test/c/inttypes.zig+3| ... | ... | @@ -10,6 +10,9 @@ test "imaxabs" { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 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 | ||
| 13 | 16 | const expected: c.imaxdiv_t = .{ .quot = 9, .rem = 0 }; |
| 14 | 17 | try testing.expectEqual(expected, c.imaxdiv(9, 1)); |
| 15 | 18 | } |
test/c/math.zig+3| ... | ... | @@ -54,6 +54,9 @@ fn testModf(comptime T: type) !void { |
| 54 | 54 | test "modf" { |
| 55 | 55 | try testModf(f32); |
| 56 | 56 | try testModf(f64); |
| 57 | ||
| 58 | if (builtin.target.cpu.arch.isPowerPC()) return error.SkipZigTest; // TODO | |
| 59 | ||
| 57 | 60 | try testModf(c_longdouble); |
| 58 | 61 | } |
| 59 | 62 |
test/c/search.zig+2| ... | ... | @@ -11,6 +11,8 @@ const Node = extern struct { |
| 11 | 11 | }; |
| 12 | 12 | |
| 13 | 13 | test "insque and remque" { |
| 14 | if (builtin.target.os.tag == .windows) return; // no insque/remque | |
| 15 | ||
| 14 | 16 | var first: Node = .{ .next = null, .prev = null }; |
| 15 | 17 | var second: Node = .{ .next = null, .prev = null }; |
| 16 | 18 | var third: Node = .{ .next = null, .prev = null }; |
test/c/stdlib.zig+16| ... | ... | @@ -7,11 +7,15 @@ const math = std.math; |
| 7 | 7 | const testing = std.testing; |
| 8 | 8 | |
| 9 | 9 | test "abs" { |
| 10 | if (builtin.target.cpu.arch.isMIPS64()) return error.SkipZigTest; // TODO | |
| 11 | ||
| 10 | 12 | const val: c_int = -10; |
| 11 | 13 | try testing.expectEqual(10, c.abs(val)); |
| 12 | 14 | } |
| 13 | 15 | |
| 14 | 16 | test "labs" { |
| 17 | if (builtin.target.cpu.arch.isMIPS64() and @sizeOf(usize) == 4) return error.SkipZigTest; // TODO | |
| 18 | ||
| 15 | 19 | const val: c_long = -10; |
| 16 | 20 | try testing.expectEqual(10, c.labs(val)); |
| 17 | 21 | } |
| ... | ... | @@ -22,16 +26,28 @@ test "llabs" { |
| 22 | 26 | } |
| 23 | 27 | |
| 24 | 28 | test "div" { |
| 29 | if (builtin.target.cpu.arch.isLoongArch()) return error.SkipZigTest; // TODO | |
| 30 | if (builtin.target.cpu.arch.isMIPS64()) return error.SkipZigTest; // TODO | |
| 31 | if (builtin.target.cpu.arch.isPowerPC()) return error.SkipZigTest; // TODO | |
| 32 | if (builtin.target.cpu.arch == .s390x) return error.SkipZigTest; // TODO | |
| 33 | ||
| 25 | 34 | const expected: c.div_t = .{ .quot = 5, .rem = 5 }; |
| 26 | 35 | try testing.expectEqual(expected, c.div(55, 10)); |
| 27 | 36 | } |
| 28 | 37 | |
| 29 | 38 | test "ldiv" { |
| 39 | if (builtin.target.cpu.arch.isMIPS64() and @sizeOf(usize) == 4) return error.SkipZigTest; // TODO | |
| 40 | if (builtin.target.cpu.arch.isPowerPC32()) return error.SkipZigTest; // TODO | |
| 41 | if (builtin.target.cpu.arch == .s390x) return error.SkipZigTest; // TODO | |
| 42 | ||
| 30 | 43 | const expected: c.ldiv_t = .{ .quot = -6, .rem = 2 }; |
| 31 | 44 | try testing.expectEqual(expected, c.ldiv(38, -6)); |
| 32 | 45 | } |
| 33 | 46 | |
| 34 | 47 | test "lldiv" { |
| 48 | if (builtin.target.cpu.arch.isPowerPC32()) return error.SkipZigTest; // TODO | |
| 49 | if (builtin.target.cpu.arch == .s390x) return error.SkipZigTest; // TODO | |
| 50 | ||
| 35 | 51 | const expected: c.lldiv_t = .{ .quot = 1, .rem = 2 }; |
| 36 | 52 | try testing.expectEqual(expected, c.lldiv(5, 3)); |
| 37 | 53 | } |
test/c/stdlib/drand48.zig+8| ... | ... | @@ -5,6 +5,8 @@ const c = std.c; |
| 5 | 5 | const testing = std.testing; |
| 6 | 6 | |
| 7 | 7 | test "erand48" { |
| 8 | if (builtin.target.os.tag == .windows) return; // no erand48 | |
| 9 | ||
| 8 | 10 | var xsubi: [3]c_ushort = .{ 37174, 64810, 11603 }; |
| 9 | 11 | |
| 10 | 12 | try testing.expectApproxEqAbs(0.8965, c.erand48(&xsubi), 0.0005); |
| ... | ... | @@ -24,6 +26,10 @@ test "erand48" { |
| 24 | 26 | } |
| 25 | 27 | |
| 26 | 28 | test "jrand48" { |
| 29 | if (builtin.target.os.tag == .windows) return; // no jrand48 | |
| 30 | ||
| 31 | if (builtin.target.os.tag == .openbsd) return error.SkipZigTest; // TODO | |
| 32 | ||
| 27 | 33 | var xsubi: [3]c_ushort = .{ 25175, 11052, 45015 }; |
| 28 | 34 | |
| 29 | 35 | try testing.expectEqual(1699503220, c.jrand48(&xsubi)); |
| ... | ... | @@ -43,6 +49,8 @@ test "jrand48" { |
| 43 | 49 | } |
| 44 | 50 | |
| 45 | 51 | test "nrand48" { |
| 52 | if (builtin.target.os.tag == .windows) return; // no nrand48 | |
| 53 | ||
| 46 | 54 | var xsubi: [3]c_ushort = .{ 546, 33817, 23389 }; |
| 47 | 55 | |
| 48 | 56 | try testing.expectEqual(914920692, c.nrand48(&xsubi)); |
test/c/strings.zig+11| ... | ... | @@ -6,6 +6,8 @@ const mem = std.mem; |
| 6 | 6 | const testing = std.testing; |
| 7 | 7 | |
| 8 | 8 | test "bzero" { |
| 9 | if (builtin.target.os.tag == .windows) return; // no bzero | |
| 10 | ||
| 9 | 11 | var array: [10]u8 = [_]u8{ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' }; |
| 10 | 12 | var a = mem.zeroes([array.len]u8); |
| 11 | 13 | a[9] = '0'; |
| ... | ... | @@ -31,8 +33,17 @@ fn testFfs(comptime T: type) !void { |
| 31 | 33 | } |
| 32 | 34 | |
| 33 | 35 | test "ffs" { |
| 36 | if (builtin.target.os.tag == .openbsd) return; // no ffsl/ffsll | |
| 37 | if (builtin.target.os.tag == .windows) return; // no ffs | |
| 38 | ||
| 34 | 39 | try testFfs(c_int); |
| 40 | ||
| 41 | if (builtin.target.os.tag == .netbsd) return; // no ffsl/ffsll until 11 | |
| 42 | ||
| 35 | 43 | try testFfs(c_long); |
| 44 | ||
| 45 | if (@sizeOf(usize) == 4) return error.SkipZigTest; // TODO | |
| 46 | ||
| 36 | 47 | try testFfs(c_longlong); |
| 37 | 48 | } |
| 38 | 49 |
test/c/unistd.zig+4| ... | ... | @@ -5,6 +5,10 @@ const c = std.c; |
| 5 | 5 | const testing = std.testing; |
| 6 | 6 | |
| 7 | 7 | test "swab" { |
| 8 | if (builtin.target.cpu.arch.isMIPS64() and @sizeOf(usize) == 4) return error.SkipZigTest; // TODO | |
| 9 | if (builtin.target.cpu.arch == .x86_64 and @sizeOf(usize) == 4) return error.SkipZigTest; // TODO | |
| 10 | if (builtin.target.os.tag == .netbsd) return error.SkipZigTest; // TODO | |
| 11 | ||
| 8 | 12 | var a: [4]u8 = undefined; |
| 9 | 13 | @memset(a[0..], '\x00'); |
| 10 | 14 | c.swab("abcd", &a, 4); |