diff options
author | Miguel de Icaza <miguel@gnome.org> | 2001-09-20 03:14:09 +0400 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2001-09-20 03:14:09 +0400 |
commit | b5850646c313168d95ff7045a6788a153ec92aad (patch) | |
tree | fd15a3807513771f2299609038eb0fc881ec7423 /mcs/tests/test-3.cs | |
parent | 883bbb3ace413cd50c626b4e8a4b27db1c0b5f71 (diff) |
Flush:
svn path=/trunk/mcs/; revision=889
Diffstat (limited to 'mcs/tests/test-3.cs')
-rwxr-xr-x | mcs/tests/test-3.cs | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/mcs/tests/test-3.cs b/mcs/tests/test-3.cs new file mode 100755 index 00000000000..5e7d4e1fab2 --- /dev/null +++ b/mcs/tests/test-3.cs @@ -0,0 +1,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; + } +} |