2003-07-14 Martin Baulig <martin@ximian.com>
authorMartin Baulig <martin@novell.com>
Mon, 14 Jul 2003 16:49:40 +0000 (16:49 -0000)
committerMartin Baulig <martin@novell.com>
Mon, 14 Jul 2003 16:49:40 +0000 (16:49 -0000)
* test-204.cs: User defined conditional logical operators; bug #40505.

2003-07-14  Martin Baulig  <martin@ximian.com>

* test-203.cs: Added test for bug #33026.

svn path=/trunk/mcs/; revision=16226

mcs/tests/ChangeLog
mcs/tests/Makefile
mcs/tests/README.tests
mcs/tests/test-203.cs [new file with mode: 0644]
mcs/tests/test-204.cs [new file with mode: 0644]

index 9e6c6043c8743f1323ed3cbd1c6b153433d3b0ce..d18986f05b7a51241dbdf7d9b77cae61e74e9ae4 100755 (executable)
@@ -1,3 +1,11 @@
+2003-07-14  Martin Baulig  <martin@ximian.com>
+
+       * test-204.cs: User defined conditional logical operators; bug #40505.
+
+2003-07-14  Martin Baulig  <martin@ximian.com>
+
+       * test-203.cs: Added test for bug #33026.
+
 2003-07-13  Ravi Pratap M  <ravi@ximian.com>
 
        * test-178.cs: Use this as it is a free slot. Test 
index 3bf91b41380fa77f5cb736e9ba09881c4b99049a..a99877410fcbf94a973540e4b20c84c84bf15383 100644 (file)
@@ -32,7 +32,9 @@ TEST_SOURCES = \
        test-161 test-162 test-163 test-164 test-165 test-166 test-167 test-168 test-169 test-170 \
                 test-172 test-173 test-174 test-175 test-176 test-177          test-179 test-180 \
        test-181 test-182 test-183 test-184 test-185 test-186 test-187 test-188          test-190 \
-       test-191 test-192 test-193 test-194 test-195          test-197 test-198 test-199
+       test-191 test-192 test-193 test-194 test-195          test-197 test-198 test-199 test-200 \
+       test-201 test-202 test-203 test-204
+
 
 # 
 # NOTE: Slot test-178 is free, turns out it was an unsafe test.
index 52b8e600a27e4d3f87c4f8171daaf22616e1306c..89998e94fb2f8ebd8d083c66de66e2e043b248a0 100644 (file)
@@ -3,7 +3,7 @@ Test cases listed by Category:
 
 * Operators
 
-  test-146.cs test-175.cs test-200.cs
+  test-146.cs test-175.cs test-200.cs test-204.cs
 
 * Overloading
 
@@ -63,7 +63,7 @@ Test cases listed by Category:
 
 * Type resolution and name lookup
 
-  test-198.cs test-201.cs test-202.cs
+  test-198.cs test-201.cs test-202.cs test-203.cs
 
 Test cases listed by Number:
 ============================
@@ -307,7 +307,22 @@ Compound assignment (x = (y += 3)).  Fixes bug #45854.
 test-201.cs
 -----------
 
-Fix for Bug #35631.
+Fix for bug #35631.
+
+test-202.cs
+-----------
+
+Fix for bug #41975.
+
+test-203.cs
+-----------
+
+Fix for bug #33026.
+
+test-204.cs
+-----------
+
+User defined conditional logical operators; bug #40505.
 
 verify-1.cs
 -----------
diff --git a/mcs/tests/test-203.cs b/mcs/tests/test-203.cs
new file mode 100644 (file)
index 0000000..7b86db3
--- /dev/null
@@ -0,0 +1,22 @@
+public enum Modifiers
+{
+       Public = 0x0001
+}
+
+class Foo
+{
+       internal Modifiers Modifiers {
+               get {
+                       return Modifiers.Public;
+               }
+       }
+}
+
+class Bar
+{
+       public static int Main ()
+       {
+               System.Console.WriteLine (Modifiers.Public);
+               return 0;
+       }
+}
diff --git a/mcs/tests/test-204.cs b/mcs/tests/test-204.cs
new file mode 100644 (file)
index 0000000..3a003a3
--- /dev/null
@@ -0,0 +1,69 @@
+using System;
+
+class X
+{
+       public readonly int x;
+
+       public X (int x)
+       {
+               this.x = x;
+       }
+
+       public override string ToString ()
+       {
+               return String.Format ("X ({0})", x);
+       }
+
+       public static X operator & (X a, X b)
+       {
+               return new X (a.x * b.x);
+       }
+
+       public static X operator | (X a, X b)
+       {
+               return new X (a.x + b.x);
+       }
+
+       // Returns true if the value is odd.
+       public static bool operator true (X x)
+       {
+               return (x.x % 2) != 0;
+       }
+
+       // Returns true if the value is even.
+       public static bool operator false (X x)
+       {
+               return (x.x % 2) == 0;
+       }
+
+       public static int Test ()
+       {
+               X x = new X (3);
+               X y = new X (4);
+
+               X t1 = x && y;
+               X t2 = y && x;
+               X t3 = x || y;
+               X t4 = y || x;
+
+               // Console.WriteLine ("TEST: {0} {1} {2} {3} {4} {5}", x, y, t1, t2, t3, t4);
+
+               if (t1.x != 12)
+                       return 1;
+               if (t2.x != 4)
+                       return 2;
+               if (t3.x != 3)
+                       return 3;
+               if (t4.x != 7)
+                       return 4;
+
+               return 0;
+       }
+
+       public static int Main ()
+       {
+               int result = Test ();
+               Console.WriteLine ("RESULT: {0}", result);
+               return result;
+       }
+}