mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-17 07:44:09 +02:00
Made for (var i < GetVal())
only call GetVal()
once
This commit is contained in:
parent
70da0856a7
commit
e3bdacf505
2 changed files with 15 additions and 2 deletions
|
@ -28,6 +28,13 @@ namespace Tests
|
|||
}
|
||||
}
|
||||
|
||||
static int sGetValCount = 0;
|
||||
|
||||
static int GetVal()
|
||||
{
|
||||
return 10 + sGetValCount++;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestBasics()
|
||||
{
|
||||
|
@ -57,6 +64,14 @@ namespace Tests
|
|||
Test.Assert(e.mDispCount == 3);
|
||||
TestEnumerator2(e);
|
||||
Test.Assert(e.mDispCount == 4);
|
||||
|
||||
int iterations = 0;
|
||||
for (int i < GetVal())
|
||||
{
|
||||
iterations++;
|
||||
}
|
||||
Test.Assert(iterations == 10);
|
||||
Test.Assert(sGetValCount == 1);
|
||||
}
|
||||
|
||||
public static void TestEnumerator1(EnumeratorTest e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue