aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/eval.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-02-26 15:19:13 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-02-26 16:50:35 -0700
commit822d29286bd39b7331970e1e641ad240e7b62aee (patch)
tree2dd08b9a7d8406e79af61d074d7172196ea0ec7a /test/behavior/eval.zig
parente81b21a0ea955422835fb42a14bfa2db6bd74146 (diff)
downloadzig-822d29286bd39b7331970e1e641ad240e7b62aee.tar.gz
zig-822d29286bd39b7331970e1e641ad240e7b62aee.zip
Sema: make `align(a) T` same as `align(a:0:N) T`
where `@sizeOf(T) == N`.
Diffstat (limited to 'test/behavior/eval.zig')
-rw-r--r--test/behavior/eval.zig56
1 files changed, 15 insertions, 41 deletions
diff --git a/test/behavior/eval.zig b/test/behavior/eval.zig
index a3313011a3..c7b5b016b4 100644
--- a/test/behavior/eval.zig
+++ b/test/behavior/eval.zig
@@ -522,20 +522,12 @@ test "inlined loop has array literal with elided runtime scope on first iteratio
}
}
-test "eval @setFloatMode at compile-time" {
- if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
-
- const result = comptime fnWithFloatMode();
- try expect(result == 1234.0);
-}
-
-fn fnWithFloatMode() f32 {
- @setFloatMode(std.builtin.FloatMode.Strict);
- return 1234.0;
-}
-
test "call method on bound fn referring to var instance" {
- if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend != .stage1) {
+ // Let's delay solving this one; I want to try to eliminate bound functions from
+ // the language.
+ return error.SkipZigTest; // TODO
+ }
try expect(bound_fn() == 1237);
}
@@ -596,19 +588,6 @@ fn assertEqualPtrs(ptr1: *const u8, ptr2: *const u8) !void {
try expect(ptr1 == ptr2);
}
-test "float literal at compile time not lossy" {
- if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
-
- try expect(16777216.0 + 1.0 == 16777217.0);
- try expect(9007199254740992.0 + 1.0 == 9007199254740993.0);
-}
-
-test "f128 at compile time is lossy" {
- if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
-
- try expect(@as(f128, 10384593717069655257060992658440192.0) + 1 == 10384593717069655257060992658440192.0);
-}
-
test "string literal used as comptime slice is memoized" {
if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
@@ -714,20 +693,7 @@ fn testVarInsideInlineLoop(args: anytype) !void {
}
}
-test "bit shift a u1" {
- // note: when debugging this test case for stage2, be sure to run it
- // in valgrind. I noticed the rhs value is undefined in the lowering
- // of the const value.
- if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
-
- var x: u1 = 1;
- var y = x << 0;
- try expect(y == 1);
-}
-
test "*align(1) u16 is the same as *align(1:0:2) u16" {
- if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
-
comptime {
try expect(*align(1:0:2) u16 == *align(1) u16);
try expect(*align(2:0:2) u16 == *u16);
@@ -735,14 +701,22 @@ test "*align(1) u16 is the same as *align(1:0:2) u16" {
}
test "array concatenation forces comptime" {
- if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend != .stage1) {
+ // note: our plan is to change the language to support runtime array
+ // concatenation instead of making this test pass.
+ return error.SkipZigTest; // TODO
+ }
var a = oneItem(3) ++ oneItem(4);
try expect(std.mem.eql(i32, &a, &[_]i32{ 3, 4 }));
}
test "array multiplication forces comptime" {
- if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend != .stage1) {
+ // note: our plan is to change the language to support runtime array
+ // multiplication instead of making this test pass.
+ return error.SkipZigTest; // TODO
+ }
var a = oneItem(3) ** scalar(2);
try expect(std.mem.eql(i32, &a, &[_]i32{ 3, 3 }));