mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 15:42:49 +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"
22 lines
838 B
Zig
22 lines
838 B
Zig
const bswap = @import("bswap.zig");
|
|
const testing = @import("std").testing;
|
|
|
|
fn test__bswapsi2(a: u32, expected: u32) !void {
|
|
var result = bswap.__bswapsi2(a);
|
|
try testing.expectEqual(expected, result);
|
|
}
|
|
|
|
test "bswapsi2" {
|
|
try test__bswapsi2(0x01234567, 0x67452301); // 0..7
|
|
try test__bswapsi2(0x67452301, 0x01234567);
|
|
try test__bswapsi2(0x89abcdef, 0xefcdab89); // 8..f
|
|
try test__bswapsi2(0xefcdab89, 0x89abcdef);
|
|
try test__bswapsi2(0xdeadbeef, 0xefbeadde); // deadbeef
|
|
try test__bswapsi2(0xefbeadde, 0xdeadbeef);
|
|
try test__bswapsi2(0xdeadface, 0xcefaadde); // deadface
|
|
try test__bswapsi2(0xcefaadde, 0xdeadface);
|
|
try test__bswapsi2(0xaaaaaaaa, 0xaaaaaaaa); // uninitialized memory
|
|
try test__bswapsi2(0x00000000, 0x00000000); // 0s
|
|
try test__bswapsi2(0xffffffff, 0xffffffff); // fs
|
|
}
|