From be176910eb870209576326ffaad8bf21241fccbd Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 5 Oct 2022 14:10:11 +0200 Subject: refactor(sim/core): Rename runBlockingSimulation to runSimulation This change renames the method `runBlockingSimulation` to `runSimulation` to put more emphasis on the simulation part of the method. The blocking part is not that important, but this behavior is still described in the method documentation. --- .../org/opendc/simulator/network/SimNetworkSinkTest.kt | 16 ++++++++-------- .../simulator/network/SimNetworkSwitchVirtualTest.kt | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'opendc-simulator/opendc-simulator-network/src') diff --git a/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSinkTest.kt b/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSinkTest.kt index 8e95f2b0..944c4d6a 100644 --- a/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSinkTest.kt +++ b/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSinkTest.kt @@ -32,14 +32,14 @@ import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.assertThrows import org.opendc.simulator.flow.* import org.opendc.simulator.flow.source.FixedFlowSource -import org.opendc.simulator.kotlin.runBlockingSimulation +import org.opendc.simulator.kotlin.runSimulation /** * Test suite for the [SimNetworkSink] class. */ class SimNetworkSinkTest { @Test - fun testInitialState() = runBlockingSimulation { + fun testInitialState() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val sink = SimNetworkSink(engine, capacity = 100.0) @@ -49,7 +49,7 @@ class SimNetworkSinkTest { } @Test - fun testDisconnectIdempotent() = runBlockingSimulation { + fun testDisconnectIdempotent() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val sink = SimNetworkSink(engine, capacity = 100.0) @@ -58,7 +58,7 @@ class SimNetworkSinkTest { } @Test - fun testConnectCircular() = runBlockingSimulation { + fun testConnectCircular() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val sink = SimNetworkSink(engine, capacity = 100.0) @@ -68,7 +68,7 @@ class SimNetworkSinkTest { } @Test - fun testConnectAlreadyConnectedTarget() = runBlockingSimulation { + fun testConnectAlreadyConnectedTarget() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val sink = SimNetworkSink(engine, capacity = 100.0) val source = mockk(relaxUnitFun = true) @@ -80,7 +80,7 @@ class SimNetworkSinkTest { } @Test - fun testConnectAlreadyConnected() = runBlockingSimulation { + fun testConnectAlreadyConnected() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val sink = SimNetworkSink(engine, capacity = 100.0) val source1 = Source(engine) @@ -96,7 +96,7 @@ class SimNetworkSinkTest { } @Test - fun testConnect() = runBlockingSimulation { + fun testConnect() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val sink = SimNetworkSink(engine, capacity = 100.0) val source = spyk(Source(engine)) @@ -112,7 +112,7 @@ class SimNetworkSinkTest { } @Test - fun testDisconnect() = runBlockingSimulation { + fun testDisconnect() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val sink = SimNetworkSink(engine, capacity = 100.0) val source = spyk(Source(engine)) diff --git a/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtualTest.kt b/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtualTest.kt index b45b150d..ff6cb66e 100644 --- a/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtualTest.kt +++ b/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtualTest.kt @@ -29,14 +29,14 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows import org.opendc.simulator.flow.* import org.opendc.simulator.flow.source.FixedFlowSource -import org.opendc.simulator.kotlin.runBlockingSimulation +import org.opendc.simulator.kotlin.runSimulation /** * Test suite for the [SimNetworkSwitchVirtual] class. */ class SimNetworkSwitchVirtualTest { @Test - fun testConnect() = runBlockingSimulation { + fun testConnect() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val sink = SimNetworkSink(engine, capacity = 100.0) val source = spyk(Source(engine)) @@ -54,7 +54,7 @@ class SimNetworkSwitchVirtualTest { } @Test - fun testConnectClosedPort() = runBlockingSimulation { + fun testConnectClosedPort() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val sink = SimNetworkSink(engine, capacity = 100.0) val switch = SimNetworkSwitchVirtual(engine) -- cgit v1.2.3