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. --- .../test/kotlin/org/opendc/simulator/power/SimPduTest.kt | 14 +++++++------- .../org/opendc/simulator/power/SimPowerSourceTest.kt | 16 ++++++++-------- .../test/kotlin/org/opendc/simulator/power/SimUpsTest.kt | 10 +++++----- 3 files changed, 20 insertions(+), 20 deletions(-) (limited to 'opendc-simulator/opendc-simulator-power') diff --git a/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPduTest.kt b/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPduTest.kt index 2177a374..29c50d3f 100644 --- a/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPduTest.kt +++ b/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPduTest.kt @@ -30,14 +30,14 @@ import org.junit.jupiter.api.assertThrows import org.opendc.simulator.flow.FlowEngine import org.opendc.simulator.flow.FlowSource import org.opendc.simulator.flow.source.FixedFlowSource -import org.opendc.simulator.kotlin.runBlockingSimulation +import org.opendc.simulator.kotlin.runSimulation /** * Test suite for the [SimPdu] class. */ internal class SimPduTest { @Test - fun testZeroOutlets() = runBlockingSimulation { + fun testZeroOutlets() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val source = SimPowerSource(engine, capacity = 100.0) val pdu = SimPdu(engine) @@ -47,7 +47,7 @@ internal class SimPduTest { } @Test - fun testSingleOutlet() = runBlockingSimulation { + fun testSingleOutlet() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val source = SimPowerSource(engine, capacity = 100.0) val pdu = SimPdu(engine) @@ -58,7 +58,7 @@ internal class SimPduTest { } @Test - fun testDoubleOutlet() = runBlockingSimulation { + fun testDoubleOutlet() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val source = SimPowerSource(engine, capacity = 100.0) val pdu = SimPdu(engine) @@ -71,7 +71,7 @@ internal class SimPduTest { } @Test - fun testDisconnect() = runBlockingSimulation { + fun testDisconnect() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val source = SimPowerSource(engine, capacity = 100.0) val pdu = SimPdu(engine) @@ -89,7 +89,7 @@ internal class SimPduTest { } @Test - fun testLoss() = runBlockingSimulation { + fun testLoss() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val source = SimPowerSource(engine, capacity = 100.0) // https://download.schneider-electric.com/files?p_Doc_Ref=SPD_NRAN-66CK3D_EN @@ -100,7 +100,7 @@ internal class SimPduTest { } @Test - fun testOutletClose() = runBlockingSimulation { + fun testOutletClose() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val source = SimPowerSource(engine, capacity = 100.0) val pdu = SimPdu(engine) diff --git a/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPowerSourceTest.kt b/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPowerSourceTest.kt index 832b9d09..b83b6ba7 100644 --- a/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPowerSourceTest.kt +++ b/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPowerSourceTest.kt @@ -33,14 +33,14 @@ import org.junit.jupiter.api.assertThrows import org.opendc.simulator.flow.FlowEngine import org.opendc.simulator.flow.FlowSource import org.opendc.simulator.flow.source.FixedFlowSource -import org.opendc.simulator.kotlin.runBlockingSimulation +import org.opendc.simulator.kotlin.runSimulation /** * Test suite for the [SimPowerSource] */ internal class SimPowerSourceTest { @Test - fun testInitialState() = runBlockingSimulation { + fun testInitialState() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val source = SimPowerSource(engine, capacity = 100.0) @@ -50,7 +50,7 @@ internal class SimPowerSourceTest { } @Test - fun testDisconnectIdempotent() = runBlockingSimulation { + fun testDisconnectIdempotent() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val source = SimPowerSource(engine, capacity = 100.0) @@ -59,7 +59,7 @@ internal class SimPowerSourceTest { } @Test - fun testConnect() = runBlockingSimulation { + fun testConnect() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val source = SimPowerSource(engine, capacity = 100.0) val inlet = SimpleInlet() @@ -74,7 +74,7 @@ internal class SimPowerSourceTest { } @Test - fun testDisconnect() = runBlockingSimulation { + fun testDisconnect() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val source = SimPowerSource(engine, capacity = 100.0) val consumer = spyk(FixedFlowSource(100.0, utilization = 1.0)) @@ -89,7 +89,7 @@ internal class SimPowerSourceTest { } @Test - fun testDisconnectAssertion() = runBlockingSimulation { + fun testDisconnectAssertion() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val source = SimPowerSource(engine, capacity = 100.0) val inlet = mockk(relaxUnitFun = true) @@ -105,7 +105,7 @@ internal class SimPowerSourceTest { } @Test - fun testOutletAlreadyConnected() = runBlockingSimulation { + fun testOutletAlreadyConnected() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val source = SimPowerSource(engine, capacity = 100.0) val inlet = SimpleInlet() @@ -119,7 +119,7 @@ internal class SimPowerSourceTest { } @Test - fun testInletAlreadyConnected() = runBlockingSimulation { + fun testInletAlreadyConnected() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val source = SimPowerSource(engine, capacity = 100.0) val inlet = mockk(relaxUnitFun = true) diff --git a/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimUpsTest.kt b/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimUpsTest.kt index e3e9dbff..2b2921d7 100644 --- a/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimUpsTest.kt +++ b/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimUpsTest.kt @@ -30,14 +30,14 @@ import org.junit.jupiter.api.Test import org.opendc.simulator.flow.FlowEngine import org.opendc.simulator.flow.FlowSource import org.opendc.simulator.flow.source.FixedFlowSource -import org.opendc.simulator.kotlin.runBlockingSimulation +import org.opendc.simulator.kotlin.runSimulation /** * Test suite for the [SimUps] class. */ internal class SimUpsTest { @Test - fun testSingleInlet() = runBlockingSimulation { + fun testSingleInlet() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val source = SimPowerSource(engine, capacity = 100.0) val ups = SimUps(engine) @@ -48,7 +48,7 @@ internal class SimUpsTest { } @Test - fun testDoubleInlet() = runBlockingSimulation { + fun testDoubleInlet() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val source1 = SimPowerSource(engine, capacity = 100.0) val source2 = SimPowerSource(engine, capacity = 100.0) @@ -65,7 +65,7 @@ internal class SimUpsTest { } @Test - fun testLoss() = runBlockingSimulation { + fun testLoss() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val source = SimPowerSource(engine, capacity = 100.0) // https://download.schneider-electric.com/files?p_Doc_Ref=SPD_NRAN-66CK3D_EN @@ -77,7 +77,7 @@ internal class SimUpsTest { } @Test - fun testDisconnect() = runBlockingSimulation { + fun testDisconnect() = runSimulation { val engine = FlowEngine(coroutineContext, clock) val source1 = SimPowerSource(engine, capacity = 100.0) val source2 = SimPowerSource(engine, capacity = 100.0) -- cgit v1.2.3