From fb2a1cc1cc2665747aa7646cd9c6b8f8d4cd9132 Mon Sep 17 00:00:00 2001 From: Kyungwoo Lee Date: Mon, 23 Feb 2015 12:41:16 -0800 Subject: [PATCH] Add a switch test to cover Jit codegen. This is a test case to cover switch expansion in Reader. --- tests/src/JIT/CodeGenBringUpTests/Switch.cs | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/src/JIT/CodeGenBringUpTests/Switch.cs diff --git a/tests/src/JIT/CodeGenBringUpTests/Switch.cs b/tests/src/JIT/CodeGenBringUpTests/Switch.cs new file mode 100644 index 0000000..770ec54 --- /dev/null +++ b/tests/src/JIT/CodeGenBringUpTests/Switch.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; +class SwitchTest +{ + const int Pass = 100; + const int Fail = -1; + + public static int Main() + { + int sum =0; + for(int i=2; i < 5; i++) { + switch(i) { + case 2: + sum += i; + break; + case 3: + sum += i; + break; + default: + sum -= 5; + break; + } + } + + return sum == 0 ? Pass : Fail; + } +} \ No newline at end of file -- 2.7.4