New test.
[mono.git] / mcs / tests / test-7.cs
index d3a9a9f34b1b1ab848164f215fb57ff6ce277287..8d27a6dec75a797514cddef3046d6492ac945db6 100644 (file)
@@ -2,6 +2,25 @@ using System;
 
 namespace Mine {
 
+       public class MyBoolean {
+               public static implicit operator bool (MyBoolean x)
+               {
+                       return true;
+               }
+       }
+
+       public class MyTrueFalse {
+               public static bool operator true (MyTrueFalse i)
+               {
+                       return true;
+               }
+               
+               public static bool operator false (MyTrueFalse i)
+               {
+                       return false;
+               }
+       }
+       
        public class Blah {
 
                public int i;
@@ -68,7 +87,20 @@ namespace Mine {
 
                        if (i != 0)
                                return 1;
+
+                       MyBoolean myb = new MyBoolean ();
+
+                       if (!myb)
+                               return 10;
+
+                       //
+                       // Tests the conditional operator invoking operator true
+                       MyTrueFalse mf = new MyTrueFalse ();
+                       int x = mf ? 1 : 2;
+                       if (x != 1)
+                               return 11;
                        
+                       Console.WriteLine ("Test passed");
                        return 0;
                }