aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/eval.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-12-29 00:39:25 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-12-29 00:39:25 -0700
commitbe5130ec535456559497ac241ac9fa76c4bbb8ca (patch)
tree072927858110cb69ccc85c31ed1b2055ee83875e /test/behavior/eval.zig
parentefb7148a4574c608b21359fcbf2edf06afdb5e0c (diff)
downloadzig-be5130ec535456559497ac241ac9fa76c4bbb8ca.tar.gz
zig-be5130ec535456559497ac241ac9fa76c4bbb8ca.zip
compiler_rt: move more functions to the stage2 section
also move more already-passing behavior tests to the passing section.
Diffstat (limited to 'test/behavior/eval.zig')
-rw-r--r--test/behavior/eval.zig25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/behavior/eval.zig b/test/behavior/eval.zig
index 01d62f353f..9fb6e9a8ce 100644
--- a/test/behavior/eval.zig
+++ b/test/behavior/eval.zig
@@ -467,3 +467,28 @@ test "comptime shlWithOverflow" {
try expect(ct_shifted == rt_shifted);
}
+
+test "const ptr to variable data changes at runtime" {
+ try expect(foo_ref.name[0] == 'a');
+ foo_ref.name = "b";
+ try expect(foo_ref.name[0] == 'b');
+}
+
+const Foo = struct {
+ name: []const u8,
+};
+
+var foo_contents = Foo{ .name = "a" };
+const foo_ref = &foo_contents;
+
+test "runtime 128 bit integer division" {
+ var a: u128 = 152313999999999991610955792383;
+ var b: u128 = 10000000000000000000;
+ var c = a / b;
+ try expect(c == 15231399999);
+}
+
+test "@tagName of @typeInfo" {
+ const str = @tagName(@typeInfo(u8));
+ try expect(std.mem.eql(u8, str, "Int"));
+}