From: Jb Evain Date: Wed, 28 May 2008 14:24:06 +0000 (-0000) Subject: lifted unary operators tests X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=6c8777b0207f4f5a67083cc268e4f4f21cc93339;p=mono.git lifted unary operators tests svn path=/trunk/mcs/; revision=104262 --- diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Negate.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Negate.cs index 369e67b26a8..59f00409b40 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Negate.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Negate.cs @@ -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> (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)); + } } } diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Not.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Not.cs index 8f54d22edbc..74c5fc5b85d 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Not.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Not.cs @@ -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> (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> (Expression.Not (p), p).Compile (); + + Assert.AreEqual ((bool?) null, not (null)); + Assert.AreEqual ((bool?) false, not (true)); + Assert.AreEqual ((bool?) true, not (false)); + } } }