authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-04-30 14:17:16-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-04-30 14:17:16-04:00
log9dfd24a3345c83c9cd32d45bef3076bb94bc0eaa
tree4f2bd5a4cf75462927d6ce6fc6ed6a090a8e7ac7
parent81767a658d07219a402384f98a7553abcbbd2e70
signaturelock-open Commit is signed but in an unrecognized format.

add test case to cover solved bug

closes #2114

3 files changed, 22 insertions(+), 2 deletions(-)

test/stage1/behavior.zig+1
......@@ -24,6 +24,7 @@ comptime {
2424 _ = @import("behavior/bugs/1851.zig");
2525 _ = @import("behavior/bugs/1914.zig");
2626 _ = @import("behavior/bugs/2006.zig");
27 _ = @import("behavior/bugs/2114.zig");
2728 _ = @import("behavior/bugs/2346.zig");
2829 _ = @import("behavior/bugs/394.zig");
2930 _ = @import("behavior/bugs/421.zig");
test/stage1/behavior/bugs/2114.zig created+19
......@@ -0,0 +1,19 @@
1const std = @import("std");
2const expect = std.testing.expect;
3const math = std.math;
4
5fn ctz(x: var) usize {
6 return @ctz(x);
7}
8
9test "fixed" {
10 testClz();
11 comptime testClz();
12}
13
14fn testClz() void {
15 expect(ctz(u128(0x40000000000000000000000000000000)) == 126);
16 expect(math.rotl(u128, u128(0x40000000000000000000000000000000), u8(1)) == u128(0x80000000000000000000000000000000));
17 expect(ctz(u128(0x80000000000000000000000000000000)) == 127);
18 expect(ctz(math.rotl(u128, u128(0x40000000000000000000000000000000), u8(1))) == 127);
19}
test/stage1/behavior/bugs/2346.zig+2-2
......@@ -1,6 +1,6 @@
1test "" {
1test "fixed" {
22 const a: *void = undefined;
33 const b: *[1]void = a;
44 const c: *[0]u8 = undefined;
55 const d: []u8 = c;
6}
\ No newline at end of file
6}