mirror of
https://github.com/ziglang/zig.git
synced 2024-11-15 08:33:06 +00:00
universal-libc: fix strncmp tests
The specification for this function is that it returns a positive value, zero, or negative value, not that it returns the difference between ascii values.
This commit is contained in:
parent
78729c4939
commit
7a941391d8
@ -298,10 +298,10 @@ fn strerror(errnum: c_int) callconv(.C) [*:0]const u8 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test "strncmp" {
|
test "strncmp" {
|
||||||
try std.testing.expect(strncmp("a", "b", 1) == -1);
|
try std.testing.expect(strncmp("a", "b", 1) < 0);
|
||||||
try std.testing.expect(strncmp("a", "c", 1) == -2);
|
try std.testing.expect(strncmp("a", "c", 1) < 0);
|
||||||
try std.testing.expect(strncmp("b", "a", 1) == 1);
|
try std.testing.expect(strncmp("b", "a", 1) > 0);
|
||||||
try std.testing.expect(strncmp("\xff", "\x02", 1) == 253);
|
try std.testing.expect(strncmp("\xff", "\x02", 1) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO we should be able to put this directly in std/linux/x86_64.zig but
|
// TODO we should be able to put this directly in std/linux/x86_64.zig but
|
||||||
|
Loading…
Reference in New Issue
Block a user