Added a unit test to expose an exception (#14)

* added a unit test to expose the bug.

* made unit test simple.

* adding extra lines.
This commit is contained in:
Zaafar Ahmed 2021-04-08 13:25:56 -04:00 committed by GitHub
parent 5dc11e0d26
commit 0d51954b63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -301,5 +301,42 @@ namespace Tests {
Assert.AreEqual(cr.Name, "Bird", "Incorrect name of the coroutine."); Assert.AreEqual(cr.Name, "Bird", "Incorrect name of the coroutine.");
} }
[Test]
public void MovingCoroutineTest()
{
var evt = new Event();
IEnumerator<Wait> MovingCoroutine() {
while (true) {
yield return new Wait(evt);
yield return new Wait(0d);
}
}
CoroutineHandler.Start(MovingCoroutine(), "MovingCoroutine");
CoroutineHandler.RaiseEvent(evt);
CoroutineHandler.RaiseEvent(evt);
CoroutineHandler.RaiseEvent(evt);
CoroutineHandler.RaiseEvent(evt);
CoroutineHandler.Tick(1d);
CoroutineHandler.Tick(1d);
CoroutineHandler.Tick(1d);
CoroutineHandler.Tick(1d);
CoroutineHandler.RaiseEvent(evt);
CoroutineHandler.Tick(1d);
CoroutineHandler.RaiseEvent(evt);
CoroutineHandler.Tick(1d);
CoroutineHandler.RaiseEvent(evt);
CoroutineHandler.Tick(1d);
CoroutineHandler.Tick(1d);
CoroutineHandler.RaiseEvent(evt);
CoroutineHandler.Tick(1d);
CoroutineHandler.RaiseEvent(evt);
CoroutineHandler.Tick(1d);
CoroutineHandler.RaiseEvent(evt);
}
} }
} }