[msvc] Update csproj files (#4136)
[mono.git] / mcs / tests / test-7.cs
index 42be54e8c5e23aabd0eabec8495fb4216a326833..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;
@@ -53,7 +72,7 @@ namespace Mine {
 
                        int i = new Blah (5) * new Blah (10);
 
-                       if (i.i != 50)
+                       if (i != 50)
                                return 1;
 
                        k = new Blah (50);
@@ -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;
                }