Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / switch.cs
1 public class Switch {
2
3         public static int test (int n) {
4                 switch (n) {
5                 case 0: return 1;
6                 case 1: return 0;
7                 case -1: return 2;
8                 default:
9                         return 0xff;
10                 }
11                 return 100;
12         }
13
14         const string long_str =
15         "{http://schemas.xmlsoap.org/ws/2003/03/business-process/}partnerLinks";
16
17         // bug #54473
18         public static int test_string (string s) {
19                 switch (s) {
20                 case "{http://schemas.xmlsoap.org/ws/2003/03/business-process/}partnerLinks":
21                         return 1;
22                 default:
23                         return 0;
24                 }
25         }
26
27         public static int Main () {
28                 if (test(0) != 1)
29                         return 1;
30                 if (test(1) != 0)
31                         return 2;
32                 if (test(-1) != 2)
33                         return 3;
34                 if (test(3) != 0xff)
35                         return 4;
36                 if (test_string (long_str) != 1)
37                         return 5;
38                 return 0;
39         }
40 }
41
42