diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-11-26 15:38:07 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-11-26 15:38:07 -0500 |
| commit | 4619b5de0609e98c0c98fe352f3bc32f036b6ad4 (patch) | |
| tree | b58718b204a63ba21f48d7eeac067baee53e903f /test | |
| parent | 24b65e41ee241c805e0eff8212ef49c5c39e4b8e (diff) | |
| download | zig-4619b5de0609e98c0c98fe352f3bc32f036b6ad4.tar.gz zig-4619b5de0609e98c0c98fe352f3bc32f036b6ad4.zip | |
IR: support inline switch
Diffstat (limited to 'test')
| -rw-r--r-- | test/self_hosted2.zig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/self_hosted2.zig b/test/self_hosted2.zig index d3dfb6811f..0ed6bca373 100644 --- a/test/self_hosted2.zig +++ b/test/self_hosted2.zig @@ -49,6 +49,18 @@ fn testSwitchWithAllRanges(x: u32, y: u32) -> u32 { } } +fn testInlineSwitch() { + const x = 3 + 4; + const result = inline switch (x) { + 3 => 10, + 4 => 11, + 5, 6 => 12, + 7, 8 => 13, + else => 14, + }; + assert(result + 1 == 14); +} + fn assert(ok: bool) { if (!ok) @unreachable(); @@ -60,6 +72,7 @@ fn runAllTests() { inlinedLoop(); switchWithNumbers(); switchWithAllRanges(); + testInlineSwitch(); } export nakedcc fn _start() -> unreachable { |
