aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/switch.zig
diff options
context:
space:
mode:
authorjoachimschmidt557 <joachim.schmidt557@outlook.com>2022-10-23 16:53:44 +0200
committerjoachimschmidt557 <joachim.schmidt557@outlook.com>2022-11-01 20:43:27 +0100
commit3ecec50f0c530760653a73194fa3651b16647ef9 (patch)
tree1fff385d90d722b87580b5cc9db1d05d90b6d153 /test/behavior/switch.zig
parentd2a5a36cabad5a9b44538e50e9288c3a968cb9f3 (diff)
downloadzig-3ecec50f0c530760653a73194fa3651b16647ef9.tar.gz
zig-3ecec50f0c530760653a73194fa3651b16647ef9.zip
stage2 AArch64: implement basic switch statements
Diffstat (limited to 'test/behavior/switch.zig')
-rw-r--r--test/behavior/switch.zig25
1 files changed, 0 insertions, 25 deletions
diff --git a/test/behavior/switch.zig b/test/behavior/switch.zig
index b852974240..165b1a8037 100644
--- a/test/behavior/switch.zig
+++ b/test/behavior/switch.zig
@@ -5,8 +5,6 @@ const expectError = std.testing.expectError;
const expectEqual = std.testing.expectEqual;
test "switch with numbers" {
- if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
-
try testSwitchWithNumbers(13);
}
@@ -20,8 +18,6 @@ fn testSwitchWithNumbers(x: u32) !void {
}
test "switch with all ranges" {
- if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
-
try expect(testSwitchWithAllRanges(50, 3) == 1);
try expect(testSwitchWithAllRanges(101, 0) == 2);
try expect(testSwitchWithAllRanges(300, 5) == 3);
@@ -53,8 +49,6 @@ test "implicit comptime switch" {
}
test "switch on enum" {
- if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
-
const fruit = Fruit.Orange;
nonConstSwitchOnEnum(fruit);
}
@@ -72,8 +66,6 @@ fn nonConstSwitchOnEnum(fruit: Fruit) void {
}
test "switch statement" {
- if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
-
try nonConstSwitch(SwitchStatementFoo.C);
}
fn nonConstSwitch(foo: SwitchStatementFoo) !void {
@@ -89,7 +81,6 @@ const SwitchStatementFoo = enum { A, B, C, D };
test "switch with multiple expressions" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
- if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
const x = switch (returnsFive()) {
1, 2, 3 => 1,
@@ -103,8 +94,6 @@ fn returnsFive() i32 {
}
test "switch on type" {
- if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
-
try expect(trueIfBoolFalseOtherwise(bool));
try expect(!trueIfBoolFalseOtherwise(i32));
}
@@ -117,8 +106,6 @@ fn trueIfBoolFalseOtherwise(comptime T: type) bool {
}
test "switching on booleans" {
- if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
-
try testSwitchOnBools();
comptime try testSwitchOnBools();
}
@@ -170,8 +157,6 @@ test "undefined.u0" {
}
test "switch with disjoint range" {
- if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
-
var q: u8 = 0;
switch (q) {
0...125 => {},
@@ -214,8 +199,6 @@ fn poll() void {
}
test "switch on global mutable var isn't constant-folded" {
- if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
-
while (state < 2) {
poll();
}
@@ -273,7 +256,6 @@ fn testSwitchEnumPtrCapture() !void {
test "switch handles all cases of number" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
- if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
try testSwitchHandleAllCases();
comptime try testSwitchHandleAllCases();
@@ -363,8 +345,6 @@ test "anon enum literal used in switch on union enum" {
}
test "switch all prongs unreachable" {
- if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
-
try testAllProngsUnreachable();
comptime try testAllProngsUnreachable();
}
@@ -400,7 +380,6 @@ fn return_a_number() anyerror!i32 {
test "switch on integer with else capturing expr" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
- if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
const S = struct {
fn doTheTest() !void {
@@ -641,8 +620,6 @@ test "switch capture copies its payload" {
}
test "capture of integer forwards the switch condition directly" {
- if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
-
const S = struct {
fn foo(x: u8) !void {
switch (x) {
@@ -662,8 +639,6 @@ test "capture of integer forwards the switch condition directly" {
}
test "enum value without tag name used as switch item" {
- if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
-
const E = enum(u32) {
a = 1,
b = 2,