mirror of
https://github.com/ziglang/zig.git
synced 2024-11-15 16:45:27 +00:00
ec95e00e28
stage2: change logic for detecting whether the main package is inside the std package. Previously it relied on realpath() which is not portable. This uses resolve() which is how imports already work. * stage2: fix cleanup bug when creating Module * flatten lib/std/special/* to lib/* - this was motivated by making main_pkg_is_inside_std false for compiler_rt & friends. * rename "mini libc" to "universal libc"
31 lines
1.6 KiB
Zig
31 lines
1.6 KiB
Zig
const negv = @import("negv.zig");
|
|
const testing = @import("std").testing;
|
|
|
|
fn test__negvti2(a: i128, expected: i128) !void {
|
|
var result = negv.__negvti2(a);
|
|
try testing.expectEqual(expected, result);
|
|
}
|
|
|
|
test "negvti2" {
|
|
// -2^127 <= i128 <= 2^127-1
|
|
// 2^127 = 170141183460469231731687303715884105728
|
|
// 2^127+1 = 170141183460469231731687303715884105727
|
|
// TODO write panic handler for testing panics
|
|
//try test__negvti2(-170141183460469231731687303715884105728, -5); // tested with return -5; and panic
|
|
try test__negvti2(-170141183460469231731687303715884105727, 170141183460469231731687303715884105727);
|
|
try test__negvti2(-170141183460469231731687303715884105726, 170141183460469231731687303715884105726);
|
|
try test__negvti2(-170141183460469231731687303715884105725, 170141183460469231731687303715884105725);
|
|
try test__negvti2(-170141183460469231731687303715884105724, 170141183460469231731687303715884105724);
|
|
try test__negvti2(-42, 42);
|
|
try test__negvti2(-7, 7);
|
|
try test__negvti2(-1, 1);
|
|
try test__negvti2(0, 0);
|
|
try test__negvti2(1, -1);
|
|
try test__negvti2(7, -7);
|
|
try test__negvti2(42, -42);
|
|
try test__negvti2(170141183460469231731687303715884105724, -170141183460469231731687303715884105724);
|
|
try test__negvti2(170141183460469231731687303715884105725, -170141183460469231731687303715884105725);
|
|
try test__negvti2(170141183460469231731687303715884105726, -170141183460469231731687303715884105726);
|
|
try test__negvti2(170141183460469231731687303715884105727, -170141183460469231731687303715884105727);
|
|
}
|