Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-3.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5e7d4e1fab282d4ba481c59e395d508e1a2589ba (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

public class TestIntOps {

	public static sbyte sbyte_add (sbyte a, sbyte b) {
		return (sbyte)(a+b);
	}

	public static short short_add (short a, short b) {
		return (short)(a+b);
	}

	public static double double_add (double a, double b) {
		return a+b;
	}

	public static int int_add (int a, int b) {
		return a+b;
	}

	public static int int_sub (int a, int b) {
		return a-b;
	}
	
	public static int int_mul (int a, int b) {
		return a*b;
	}
	
	public static int Main() {
		int num = 1;

		if (int_add (1, 1)   != 2)  return num;
		num++;

		if (int_add (31, -1) != 30) return num;
		num++;

		if (int_sub (31, -1) != 32) return num;
		num++;

		if (int_mul (12, 12) != 144) return num;
		num++;

		if (sbyte_add (1, 1) != 2)  return num;
		num++;
		
		if (sbyte_add (31, -1) != 30)  return num;
		num++;
		
		if (short_add (1, 1) != 2)  return num;
		num++;
		
		if (short_add (31, -1) != 30)  return num;
		num++;
		
		if (double_add (1.5, 1.5) != 3)  return num;
		num++;

		// add more meaningful tests
	
    	return 0;
	}
}