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

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRavi Pratap M <ravi@mono-cvs.ximian.com>2001-10-22 16:27:45 +0400
committerRavi Pratap M <ravi@mono-cvs.ximian.com>2001-10-22 16:27:45 +0400
commite894212552f266a3f1c5798ba7e283f7ecd751dd (patch)
tree134807f80e3d857102e50417a55e477885416d1a /mcs/tests/test-7.cs
parent2bd6537a3838963f3bf34aad4eb957652c59f19a (diff)
2001-10-22 Ravi Pratap <ravi@ximian.com>
* makefile : New target 'verify' which uses the verifier to check that executables produced by us are identical to the MS' produced ones. * test-7.cs : Update to exercise more overloadable operators. svn path=/trunk/mcs/; revision=1193
Diffstat (limited to 'mcs/tests/test-7.cs')
-rw-r--r--mcs/tests/test-7.cs61
1 files changed, 53 insertions, 8 deletions
diff --git a/mcs/tests/test-7.cs b/mcs/tests/test-7.cs
index bcb2958362d..9bf10983f6d 100644
--- a/mcs/tests/test-7.cs
+++ b/mcs/tests/test-7.cs
@@ -6,18 +6,16 @@ namespace Mine {
public int i;
- public Blah ()
- {
- Console.WriteLine ("Inside the constructor now");
- }
-
public static int Main ()
{
- Blah k;
+ Blah k, l;
k = new Blah () + new Blah ();
k = ~ new Blah ();
k = + new Blah ();
+ k = - new Blah ();
+
+ k = new Blah () - new Blah ();
if (!k)
Console.WriteLine ("Overloaded ! operator returned true");
@@ -40,8 +38,26 @@ namespace Mine {
if (f == 2.0)
Console.WriteLine ("Explicit conversion correct.");
- return 0;
+
+ int i = new Blah () * new Blah ();
+
+ if (i == 50)
+ Console.WriteLine ("Multiplication correct.");
+
+ k = new Blah ();
+ l = new Blah ();
+
+ i = k / l;
+
+ if (i == 20)
+ Console.WriteLine ("Division correct");
+
+ i = k % l;
+
+ if (i == 40)
+ Console.WriteLine ("Modulo correct");
+ return 0;
}
public static Blah operator + (Blah i, Blah j)
@@ -55,8 +71,37 @@ namespace Mine {
Console.WriteLine ("Overloaded unary + operator");
return null;
}
+
+ public static Blah operator - (Blah i)
+ {
+ Console.WriteLine ("Overloaded unary - operator");
+ return null;
+ }
+
+ public static Blah operator - (Blah i, Blah j)
+ {
+ Console.WriteLine ("Overloaded binary - operator");
+ return null;
+ }
+
+ public static int operator * (Blah i, Blah j)
+ {
+ Console.WriteLine ("Overloaded binary * operator");
+ return 50;
+ }
+
+ public static int operator / (Blah i, Blah j)
+ {
+ Console.WriteLine ("Overloaded binary / operator");
+ return 20;
+ }
+
+ public static int operator % (Blah i, Blah j)
+ {
+ Console.WriteLine ("Overloaded binary % operator");
+ return 40;
+ }
-
public static Blah operator ~ (Blah i)
{
Console.WriteLine ("Overloaded ~ operator");