lifted unary operators tests
authorJb Evain <jbevain@gmail.com>
Wed, 28 May 2008 14:24:06 +0000 (14:24 -0000)
committerJb Evain <jbevain@gmail.com>
Wed, 28 May 2008 14:24:06 +0000 (14:24 -0000)
svn path=/trunk/mcs/; revision=104262

mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Negate.cs
mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Not.cs

index 369e67b26a8296f43ec337c2bb10d2c3651b1bcf..59f00409b40f0274b777a0568a86670ff7c10658 100644 (file)
@@ -112,5 +112,18 @@ namespace MonoTests.System.Linq.Expressions
                        Assert.AreEqual (0, negate (0));
                        Assert.AreEqual (3, negate (-3));
                }
+
+               [Test]
+               [Category ("NotWorking")]
+               public void CompiledNegateNullableInt32 ()
+               {
+                       var p = Expression.Parameter (typeof (int?), "i");
+                       var negate = Expression.Lambda<Func<int?, int?>> (Expression.Negate (p), p).Compile ();
+
+                       Assert.AreEqual (null, negate (null));
+                       Assert.AreEqual ((int?) -2, negate (2));
+                       Assert.AreEqual ((int?) 0, negate (0));
+                       Assert.AreEqual ((int?) 3, negate (-3));
+               }
        }
 }
index 8f54d22edbc29da6dcf0376dde1c52c6f8429628..74c5fc5b85da4758fec3db3c4f33690b7e05a6a4 100644 (file)
@@ -116,6 +116,18 @@ namespace MonoTests.System.Linq.Expressions
                        Assert.AreEqual (2, not (-3));
                }
 
+               [Test]
+               [Category ("NotWorking")]
+               public void CompiledNotNullableInt32 ()
+               {
+                       var p = Expression.Parameter (typeof (int?), "i");
+                       var not = Expression.Lambda<Func<int?, int?>> (Expression.Not (p), p).Compile ();
+
+                       Assert.AreEqual (null, not (null));
+                       Assert.AreEqual ((int?) -4, not (3));
+                       Assert.AreEqual ((int?) 2, not (-3));
+               }
+
                [Test]
                public void CompileNotBool ()
                {
@@ -125,5 +137,17 @@ namespace MonoTests.System.Linq.Expressions
                        Assert.AreEqual (false, not (true));
                        Assert.AreEqual (true, not (false));
                }
+
+               [Test]
+               [Category ("NotWorking")]
+               public void CompiledNotNullableBool ()
+               {
+                       var p = Expression.Parameter (typeof (bool?), "i");
+                       var not = Expression.Lambda<Func<bool?, bool?>> (Expression.Not (p), p).Compile ();
+
+                       Assert.AreEqual ((bool?) null, not (null));
+                       Assert.AreEqual ((bool?) false, not (true));
+                       Assert.AreEqual ((bool?) true, not (false));
+               }
        }
 }