add regression test for bitcast to array

closes #421
master
Andrew Kelley 2019-02-22 11:09:17 -05:00
parent d0c39895aa
commit 2fe8a0831f
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
2 changed files with 17 additions and 0 deletions

View File

@ -20,6 +20,7 @@ comptime {
_ = @import("behavior/bugs/1486.zig");
_ = @import("behavior/bugs/1851.zig");
_ = @import("behavior/bugs/394.zig");
_ = @import("behavior/bugs/421.zig");
_ = @import("behavior/bugs/655.zig");
_ = @import("behavior/bugs/656.zig");
_ = @import("behavior/bugs/726.zig");

View File

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