zig/test/behavior/bugs/421.zig
Andrew Kelley 4307436b99 move behavior tests from test/stage1/ to test/
And fix test cases to make them pass. This is in preparation for
starting to pass behavior tests with self-hosted.
2021-04-29 15:54:04 -07:00

16 lines
334 B
Zig

const expect = @import("std").testing.expect;
test "bitCast to array" {
comptime testBitCastArray();
testBitCastArray();
}
fn testBitCastArray() void {
expect(extractOne64(0x0123456789abcdef0123456789abcdef) == 0x0123456789abcdef);
}
fn extractOne64(a: u128) u64 {
const x = @bitCast([2]u64, a);
return x[1];
}