Author: martin
Date: 2005-03-13 02:13:19 -0500 (Sun, 13 Mar 2005)
New Revision: 41747
Added:
trunk/mcs/tests/gen-142.cs
Modified:
trunk/mcs/tests/Makefile
Log:
New test.
Modified: trunk/mcs/tests/Makefile
===================================================================
--- trunk/mcs/tests/Makefile 2005-03-13 07:11:42 UTC (rev 41746)
+++ trunk/mcs/tests/Makefile 2005-03-13 07:13:19 UTC (rev 41747)
@@ -120,8 +120,9 @@
gen-91 gen-92 gen-93 gen-94 gen-95 gen-96 gen-97
gen-100 \
gen-101 gen-102 gen-103 gen-104 gen-105 gen-106 gen-107 gen-108 gen-109
gen-110 \
gen-111 gen-112 gen-113 gen-114 gen-115 gen-116 gen-117 gen-118 gen-119
gen-120 \
- gen-121 gen-122 gen-123 gen-124 gen-125 gen-127 gen-128 gen-129
\
- gen-132 gen-133 gen-134 gen-135 gen-136 gen-137 gen-138 gen-139
gen-140
+ gen-121 gen-122 gen-123 gen-124 gen-125 gen-127 gen-128 gen-129
gen-130 \
+ gen-132 gen-133 gen-134 gen-135 gen-136 gen-137 gen-138 gen-139
gen-140 \
+ gen-141 gen-142
# gen-72 fails after the runtime changes in r40305
TEST_EXCLUDES_net_2_0 = $(NEW_TEST_SOURCES_common) gen-72
Added: trunk/mcs/tests/gen-142.cs
===================================================================
--- trunk/mcs/tests/gen-142.cs 2005-03-13 07:11:42 UTC (rev 41746)
+++ trunk/mcs/tests/gen-142.cs 2005-03-13 07:13:19 UTC (rev 41747)
@@ -0,0 +1,115 @@
+using System;
+
+public static class Assert
+{
+ public static int Errors {
+ get { return errors; }
+ }
+
+ static int errors = 0;
+
+ static void Error (string method, string text)
+ {
+ Console.WriteLine ("Assert failed: {0} ({1})", method, text);
+ errors++;
+ }
+
+ public static void IsTrue (string text, bool b)
+ {
+ if (!b)
+ Error ("IsTrue", text);
+ }
+
+ public static void IsFalse (string text, bool b)
+ {
+ if (b)
+ Error ("IsFalse", text);
+ }
+
+ public static void IsNull<T> (string text, Nullable<T> nullable)
+ {
+ if (nullable.HasValue)
+ Error ("IsNull", text);
+ }
+
+ public static void IsNotNull<T> (string text, Nullable<T> nullable)
+ {
+ if (!nullable.HasValue)
+ Error ("IsNotNull", text);
+ }
+
+ public static void IsTrue (string text, Nullable<bool> b)
+ {
+ if (!b.HasValue || !b.Value)
+ Error ("IsTrue", text);
+ }
+
+ public static void IsFalse (string text, Nullable<bool> b)
+ {
+ if (!b.HasValue || b.Value)
+ Error ("IsFalse", text);
+ }
+}
+
+class X
+{
+ static int Main ()
+ {
+ bool? a = null, b = false, c = true;
+ bool? d = null, e = false, f = true;
+
+ Assert.IsNull ("a", a);
+ Assert.IsFalse ("b", b);
+ Assert.IsTrue ("c", c);
+ Assert.IsTrue ("a == d", a == d);
+ Assert.IsTrue ("b == e", b == e);
+ Assert.IsTrue ("c == f", c == f);
+
+ Assert.IsFalse ("a != d", a != d);
+ Assert.IsFalse ("a == b", a == b);
+ Assert.IsTrue ("a != b", a != b);
+
+ Assert.IsNull ("d & a", d & a);
+ Assert.IsFalse ("d & b", d & b);
+ Assert.IsNull ("d & c", d & c);
+ Assert.IsFalse ("e & a", e & a);
+ Assert.IsFalse ("e & b", e & b);
+ Assert.IsFalse ("e & c", e & c);
+ Assert.IsNull ("f & a", f & a);
+ Assert.IsFalse ("f & b", f & b);
+ Assert.IsTrue ("f & c", f & c);
+
+ Assert.IsNull ("d | a", d | a);
+ Assert.IsNull ("d | b", d | b);
+ Assert.IsTrue ("d | c", d | c);
+ Assert.IsNull ("e | a", e | a);
+ Assert.IsFalse ("e | b", e | b);
+ Assert.IsTrue ("e | c", e | c);
+ Assert.IsTrue ("f | a", f | a);
+ Assert.IsTrue ("f | b", f | b);
+ Assert.IsTrue ("f | c", f | c);
+
+ Assert.IsNull ("d && a", d && a);
+ Assert.IsFalse ("d && b", d && b);
+ Assert.IsNull ("d && c", d && c);
+ Assert.IsFalse ("e && a", e && a);
+ Assert.IsFalse ("e && b", e && b);
+ Assert.IsFalse ("e && c", e && c);
+ Assert.IsNull ("f && a", f && a);
+ Assert.IsFalse ("f && b", f && b);
+ Assert.IsTrue ("f && c", f && c);
+
+ Assert.IsNull ("d || a", d || a);
+ Assert.IsNull ("d || b", d || b);
+ Assert.IsTrue ("d || c", d || c);
+ Assert.IsNull ("e || a", e || a);
+ Assert.IsFalse ("e || b", e || b);
+ Assert.IsTrue ("e || c", e || c);
+ Assert.IsTrue ("f || a", f || a);
+ Assert.IsTrue ("f || b", f || b);
+ Assert.IsTrue ("f || c", f || c);
+
+ Console.WriteLine ("{0} errors.", Assert.Errors);
+ return Assert.Errors;
+ }
+}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches