summaryrefslogtreecommitdiff
path: root/tests/src
diff options
context:
space:
mode:
authorKyungwoo Lee <kyulee@microsoft.com>2015-02-23 12:41:16 -0800
committerKyungwoo Lee <kyulee@microsoft.com>2015-02-23 20:13:27 -0800
commitfb2a1cc1cc2665747aa7646cd9c6b8f8d4cd9132 (patch)
tree33e3321e59f1033a266b345233cd4532d8b04fcb /tests/src
parent63976a08fbe6ece34a2936ebccdf735ea32044a2 (diff)
downloadcoreclr-fb2a1cc1cc2665747aa7646cd9c6b8f8d4cd9132.tar.gz
coreclr-fb2a1cc1cc2665747aa7646cd9c6b8f8d4cd9132.tar.bz2
coreclr-fb2a1cc1cc2665747aa7646cd9c6b8f8d4cd9132.zip
Add a switch test to cover Jit codegen.
This is a test case to cover switch expansion in Reader.
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/JIT/CodeGenBringUpTests/Switch.cs30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/src/JIT/CodeGenBringUpTests/Switch.cs b/tests/src/JIT/CodeGenBringUpTests/Switch.cs
new file mode 100644
index 0000000000..770ec54b29
--- /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