2009-12-12 Rodrigo Kumpera <rkumpera@novell.com>
[mcs.git] / tests / test-3.cs
blob5e7d4e1fab282d4ba481c59e395d508e1a2589ba
2 public class TestIntOps {
4 public static sbyte sbyte_add (sbyte a, sbyte b) {
5 return (sbyte)(a+b);
8 public static short short_add (short a, short b) {
9 return (short)(a+b);
12 public static double double_add (double a, double b) {
13 return a+b;
16 public static int int_add (int a, int b) {
17 return a+b;
20 public static int int_sub (int a, int b) {
21 return a-b;
24 public static int int_mul (int a, int b) {
25 return a*b;
28 public static int Main() {
29 int num = 1;
31 if (int_add (1, 1) != 2) return num;
32 num++;
34 if (int_add (31, -1) != 30) return num;
35 num++;
37 if (int_sub (31, -1) != 32) return num;
38 num++;
40 if (int_mul (12, 12) != 144) return num;
41 num++;
43 if (sbyte_add (1, 1) != 2) return num;
44 num++;
46 if (sbyte_add (31, -1) != 30) return num;
47 num++;
49 if (short_add (1, 1) != 2) return num;
50 num++;
52 if (short_add (31, -1) != 30) return num;
53 num++;
55 if (double_add (1.5, 1.5) != 3) return num;
56 num++;
58 // add more meaningful tests
60 return 0;