Class ForLoopTests
Inherited Members
Namespace: Unity.VisualScripting.Tests.Units.Control
Assembly: solution.dll
Syntax
public class ForLoopTests : BaseGraphExecutionTests
Methods
TestBreakTakesEffectAfterBodyFinishes()
If a break operation is performed, it doesn't take effect until after the body action finishes and the flow returns to the For Loop node.
Declaration
public void TestBreakTakesEffectAfterBodyFinishes()
Remarks
This differs from most programming languages, where a break will immediately break out of a loop, without first executing the rest of the body.
TestCountingDown()
Declaration
public void TestCountingDown()
TestCountingUpBy2()
Declaration
public void TestCountingUpBy2()
TestCountingUpBy3()
Declaration
public void TestCountingUpBy3()
TestDefaultValues()
The default values on a newly created for loop are to loop from 0 to 10, with a step of 1.
Declaration
public void TestDefaultValues()
TestFloatParameters()
It is possible to pass floating point values to the first, last and step inputs.
Declaration
public void TestFloatParameters()
TestFloatStepThatRoundsToZero()
If a floating point step is passed in that rounds to zero, then the loop will not emit any values.
Declaration
public void TestFloatStepThatRoundsToZero()
TestIndexAfterBreakExit()
After a loop exits because of a break, nodes can still access the index ValueOutput, which is then set to the value for which the body triggered the break.
Declaration
public void TestIndexAfterBreakExit()
TestIndexAfterLoopExit()
After a loop exits, nodes can still access the index ValueOutput, which is then set to the value after the last value the body is triggered with.
Declaration
public void TestIndexAfterLoopExit()
TestLoopTo10()
Test a simple loop from 0 to 10 (exclusive).
Declaration
public void TestLoopTo10()
Remarks
Note that though the connection for the end value is called "Last", this is not the last value the body will be triggered for.
TestNonIntegerFloatParameters()
It is possible to pass non-integer floating point values to the first, last and step inputs. The loop is executed as if the closest integers were passed in.
Declaration
public void TestNonIntegerFloatParameters()
TestStepOfZero()
If a step of zero is used, then the loop will not emit any values.
Declaration
public void TestStepOfZero()
TestTwoBreaks()
If two breaks are executed in the body of a for loop, the second one fails with an InvalidOperationException.
Declaration
public void TestTwoBreaks()
TestTwoBreaksInBodyOfNestedLoop()
If two breaks are executed in the body of two nested for loops, then both loops are exited out of immediately.
Declaration
public void TestTwoBreaksInBodyOfNestedLoop()