add test case to cover solved bug

closes #2114
This commit is contained in:
Andrew Kelley 2019-04-30 14:17:16 -04:00
parent 81767a658d
commit 9dfd24a334
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
3 changed files with 22 additions and 2 deletions

View File

@ -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");

View File

@ -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);
}

View File

@ -1,4 +1,4 @@
test "" {
test "fixed" {
const a: *void = undefined;
const b: *[1]void = a;
const c: *[0]u8 = undefined;