mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-17 23:56:05 +02:00
Fixed operator constraint checking with generic operators
This commit is contained in:
parent
48f2ec42f5
commit
d0cfb37309
2 changed files with 56 additions and 13 deletions
|
@ -59,6 +59,11 @@ namespace Tests
|
|||
Test.Assert(i == 100);
|
||||
}
|
||||
|
||||
public static T DoAdd<T>(T lhs, T rhs) where T : operator T + T
|
||||
{
|
||||
return lhs + rhs;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestOperators()
|
||||
{
|
||||
|
@ -84,6 +89,9 @@ namespace Tests
|
|||
Test.Assert(iNull == 100);
|
||||
Test.Assert(iNull != 99);
|
||||
Test.Assert(!(iNull != 100));
|
||||
|
||||
Test.Assert(DoAdd(iNull, iNull) == 200);
|
||||
Test.Assert(DoAdd(iNull, null) == null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue