diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-04-30 14:17:16 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-04-30 14:17:16 -0400 |
| commit | 9dfd24a3345c83c9cd32d45bef3076bb94bc0eaa (patch) | |
| tree | 4f2bd5a4cf75462927d6ce6fc6ed6a090a8e7ac7 /test/stage1 | |
| parent | 81767a658d07219a402384f98a7553abcbbd2e70 (diff) | |
| download | zig-9dfd24a3345c83c9cd32d45bef3076bb94bc0eaa.tar.gz zig-9dfd24a3345c83c9cd32d45bef3076bb94bc0eaa.zip | |
add test case to cover solved bug
closes #2114
Diffstat (limited to 'test/stage1')
| -rw-r--r-- | test/stage1/behavior.zig | 1 | ||||
| -rw-r--r-- | test/stage1/behavior/bugs/2114.zig | 19 | ||||
| -rw-r--r-- | test/stage1/behavior/bugs/2346.zig | 4 |
3 files changed, 22 insertions, 2 deletions
diff --git a/test/stage1/behavior.zig b/test/stage1/behavior.zig index 85dd606872..bc3be172ab 100644 --- a/test/stage1/behavior.zig +++ b/test/stage1/behavior.zig @@ -24,6 +24,7 @@ comptime { _ = @import("behavior/bugs/1851.zig"); _ = @import("behavior/bugs/1914.zig"); _ = @import("behavior/bugs/2006.zig"); + _ = @import("behavior/bugs/2114.zig"); _ = @import("behavior/bugs/2346.zig"); _ = @import("behavior/bugs/394.zig"); _ = @import("behavior/bugs/421.zig"); diff --git a/test/stage1/behavior/bugs/2114.zig b/test/stage1/behavior/bugs/2114.zig new file mode 100644 index 0000000000..61ea2675b9 --- /dev/null +++ b/test/stage1/behavior/bugs/2114.zig @@ -0,0 +1,19 @@ +const std = @import("std"); +const expect = std.testing.expect; +const math = std.math; + +fn ctz(x: var) usize { + return @ctz(x); +} + +test "fixed" { + testClz(); + comptime testClz(); +} + +fn testClz() void { + expect(ctz(u128(0x40000000000000000000000000000000)) == 126); + expect(math.rotl(u128, u128(0x40000000000000000000000000000000), u8(1)) == u128(0x80000000000000000000000000000000)); + expect(ctz(u128(0x80000000000000000000000000000000)) == 127); + expect(ctz(math.rotl(u128, u128(0x40000000000000000000000000000000), u8(1))) == 127); +} diff --git a/test/stage1/behavior/bugs/2346.zig b/test/stage1/behavior/bugs/2346.zig index 3d76fc4bfe..c8cea34813 100644 --- a/test/stage1/behavior/bugs/2346.zig +++ b/test/stage1/behavior/bugs/2346.zig @@ -1,6 +1,6 @@ -test "" { +test "fixed" { const a: *void = undefined; const b: *[1]void = a; const c: *[0]u8 = undefined; const d: []u8 = c; -}
\ No newline at end of file +} |
