mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Delegate comparison expansion, hashable, == operator
This commit is contained in:
parent
9dcafb7db8
commit
a3a8bfa40c
8 changed files with 157 additions and 18 deletions
|
@ -182,6 +182,29 @@ namespace Tests
|
|||
|
||||
delegate Vector3f() vecDlg = scope => GetVector3f;
|
||||
Test.Assert(vecDlg().mX == 101);
|
||||
|
||||
int allocCount = 0;
|
||||
|
||||
Action act = null;
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
int j = i / 3;
|
||||
Action newAct = scope:: () =>
|
||||
{
|
||||
Console.WriteLine($"act {j}");
|
||||
};
|
||||
|
||||
if (act == null || act != newAct)
|
||||
{
|
||||
act = newAct;
|
||||
allocCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Test.Assert(act.GetHashCode() == newAct.GetHashCode());
|
||||
}
|
||||
}
|
||||
Test.Assert(allocCount == 4);
|
||||
}
|
||||
|
||||
public static void Modify(ref int a, ref Splattable b)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue