Add a switch test to cover Jit codegen.
authorKyungwoo Lee <kyulee@microsoft.com>
Mon, 23 Feb 2015 20:41:16 +0000 (12:41 -0800)
committerKyungwoo Lee <kyulee@microsoft.com>
Tue, 24 Feb 2015 04:13:27 +0000 (20:13 -0800)
This is a test case to cover switch expansion in Reader.

tests/src/JIT/CodeGenBringUpTests/Switch.cs [new file with mode: 0644]

diff --git a/tests/src/JIT/CodeGenBringUpTests/Switch.cs b/tests/src/JIT/CodeGenBringUpTests/Switch.cs
new file mode 100644 (file)
index 0000000..770ec54
--- /dev/null
@@ -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