mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Nullable fixes with !=
This commit is contained in:
parent
bf80ec8897
commit
952e3aec58
4 changed files with 32 additions and 5 deletions
|
@ -55,7 +55,7 @@ namespace Tests
|
|||
Test.FatalError();
|
||||
|
||||
Test.Assert(ca?.mCondB?.mStr == null);
|
||||
Test.Assert(!(ca?.mCondB?.mStr?.Length != 0));
|
||||
Test.Assert(ca?.mCondB?.mStr?.Length != 0);
|
||||
Test.Assert(!(ca?.mCondB?.mStr?.Length == 0));
|
||||
|
||||
if (let i = ca?.mCondB?.mInt)
|
||||
|
|
|
@ -31,5 +31,32 @@ namespace Tests
|
|||
Test.Assert(!intn2.TryGetValue(ref i));
|
||||
Test.Assert(i == 100);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestOperators()
|
||||
{
|
||||
int? iNull = null;
|
||||
bool? bNull = null;
|
||||
|
||||
Test.Assert(!(iNull == 0));
|
||||
Test.Assert(!(iNull <= 0));
|
||||
Test.Assert(!(iNull >= 0));
|
||||
|
||||
Test.Assert(!(bNull == false));
|
||||
Test.Assert(!(bNull == true));
|
||||
Test.Assert(bNull != true);
|
||||
Test.Assert(bNull != false);
|
||||
|
||||
iNull = 100;
|
||||
bNull = false;
|
||||
|
||||
Test.Assert(iNull >= 50);
|
||||
Test.Assert(!(iNull >= 150));
|
||||
Test.Assert(iNull < 150);
|
||||
Test.Assert(!(iNull < 50));
|
||||
Test.Assert(iNull == 100);
|
||||
Test.Assert(iNull != 99);
|
||||
Test.Assert(!(iNull != 100));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue