summaryrefslogtreecommitdiff
path: root/tests/src/JIT/CodeGenBringUpTests/Switch.cs
blob: 770ec54b291a08276a0e66615b11cf89586c983c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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;
 }
}