aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
authorRobin Voetter <robin@voetter.nl>2021-10-16 14:47:55 +0200
committerRobin Voetter <robin@voetter.nl>2021-10-17 20:33:04 +0200
commit9336a87452eda87c19cb707484d0b6dfb4140b57 (patch)
tree72d50163e2ad1389d5752de0e841b8f68755f3d5 /test/behavior
parent6a3659c4e005d9730fb824b77b416ef33200dbfe (diff)
downloadzig-9336a87452eda87c19cb707484d0b6dfb4140b57.tar.gz
zig-9336a87452eda87c19cb707484d0b6dfb4140b57.zip
stage2: bitNot
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/math.zig14
-rw-r--r--test/behavior/math_stage1.zig14
2 files changed, 14 insertions, 14 deletions
diff --git a/test/behavior/math.zig b/test/behavior/math.zig
index 56fbdc124d..8ca757b0cc 100644
--- a/test/behavior/math.zig
+++ b/test/behavior/math.zig
@@ -235,3 +235,17 @@ test "comptime_int param and return" {
fn comptimeAdd(comptime a: comptime_int, comptime b: comptime_int) comptime_int {
return a + b;
}
+
+test "binary not" {
+ try expect(comptime x: {
+ break :x ~@as(u16, 0b1010101010101010) == 0b0101010101010101;
+ });
+ try expect(comptime x: {
+ break :x ~@as(u64, 2147483647) == 18446744071562067968;
+ });
+ try testBinaryNot(0b1010101010101010);
+}
+
+fn testBinaryNot(x: u16) !void {
+ try expect(~x == 0b0101010101010101);
+}
diff --git a/test/behavior/math_stage1.zig b/test/behavior/math_stage1.zig
index f0c160ebc4..caec185414 100644
--- a/test/behavior/math_stage1.zig
+++ b/test/behavior/math_stage1.zig
@@ -219,20 +219,6 @@ const DivResult = struct {
remainder: u64,
};
-test "binary not" {
- try expect(comptime x: {
- break :x ~@as(u16, 0b1010101010101010) == 0b0101010101010101;
- });
- try expect(comptime x: {
- break :x ~@as(u64, 2147483647) == 18446744071562067968;
- });
- try testBinaryNot(0b1010101010101010);
-}
-
-fn testBinaryNot(x: u16) !void {
- try expect(~x == 0b0101010101010101);
-}
-
test "small int addition" {
var x: u2 = 0;
try expect(x == 0);