diff options
author | Kyungwoo Lee <kyulee@microsoft.com> | 2015-02-23 12:41:16 -0800 |
---|---|---|
committer | Kyungwoo Lee <kyulee@microsoft.com> | 2015-02-23 20:13:27 -0800 |
commit | fb2a1cc1cc2665747aa7646cd9c6b8f8d4cd9132 (patch) | |
tree | 33e3321e59f1033a266b345233cd4532d8b04fcb /tests | |
parent | 63976a08fbe6ece34a2936ebccdf735ea32044a2 (diff) | |
download | coreclr-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')
-rw-r--r-- | tests/src/JIT/CodeGenBringUpTests/Switch.cs | 30 |
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 |