1
0
Fork 0
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:
Brian Fiete 2022-02-15 09:31:23 -05:00
parent 9dcafb7db8
commit a3a8bfa40c
8 changed files with 157 additions and 18 deletions

View file

@ -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)