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. --- .../src/test/kotlin/org/opendc/common/util/PacerTest.kt | 12 ++++++------ .../kotlin/org/opendc/common/util/TimerSchedulerTest.kt | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'opendc-common') diff --git a/opendc-common/src/test/kotlin/org/opendc/common/util/PacerTest.kt b/opendc-common/src/test/kotlin/org/opendc/common/util/PacerTest.kt index 066bc13b..de9fd472 100644 --- a/opendc-common/src/test/kotlin/org/opendc/common/util/PacerTest.kt +++ b/opendc-common/src/test/kotlin/org/opendc/common/util/PacerTest.kt @@ -26,7 +26,7 @@ import kotlinx.coroutines.delay import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows -import org.opendc.simulator.kotlin.runBlockingSimulation +import org.opendc.simulator.kotlin.runSimulation import java.time.Clock import kotlin.coroutines.EmptyCoroutineContext @@ -43,7 +43,7 @@ class PacerTest { fun testSingleEnqueue() { var count = 0 - runBlockingSimulation { + runSimulation { val pacer = Pacer(coroutineContext, clock, quantum = 100) { count++ } @@ -58,7 +58,7 @@ class PacerTest { fun testCascade() { var count = 0 - runBlockingSimulation { + runSimulation { val pacer = Pacer(coroutineContext, clock, quantum = 100) { count++ } @@ -76,7 +76,7 @@ class PacerTest { fun testCancel() { var count = 0 - runBlockingSimulation { + runSimulation { val pacer = Pacer(coroutineContext, clock, quantum = 100) { count++ } @@ -94,7 +94,7 @@ class PacerTest { fun testCancelWithoutPending() { var count = 0 - runBlockingSimulation { + runSimulation { val pacer = Pacer(coroutineContext, clock, quantum = 100) { count++ } @@ -112,7 +112,7 @@ class PacerTest { fun testSubsequent() { var count = 0 - runBlockingSimulation { + runSimulation { val pacer = Pacer(coroutineContext, clock, quantum = 100) { count++ } diff --git a/opendc-common/src/test/kotlin/org/opendc/common/util/TimerSchedulerTest.kt b/opendc-common/src/test/kotlin/org/opendc/common/util/TimerSchedulerTest.kt index 93da5646..183ab66a 100644 --- a/opendc-common/src/test/kotlin/org/opendc/common/util/TimerSchedulerTest.kt +++ b/opendc-common/src/test/kotlin/org/opendc/common/util/TimerSchedulerTest.kt @@ -26,7 +26,7 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows -import org.opendc.simulator.kotlin.runBlockingSimulation +import org.opendc.simulator.kotlin.runSimulation import java.time.Clock import kotlin.coroutines.EmptyCoroutineContext @@ -42,7 +42,7 @@ internal class TimerSchedulerTest { @Test fun testBasicTimer() { - runBlockingSimulation { + runSimulation { val scheduler = TimerScheduler(coroutineContext, clock) scheduler.startSingleTimer(0, 1000) { @@ -56,7 +56,7 @@ internal class TimerSchedulerTest { @Test fun testCancelNonExisting() { - runBlockingSimulation { + runSimulation { val scheduler = TimerScheduler(coroutineContext, clock) scheduler.cancel(1) @@ -65,7 +65,7 @@ internal class TimerSchedulerTest { @Test fun testCancelExisting() { - runBlockingSimulation { + runSimulation { val scheduler = TimerScheduler(coroutineContext, clock) scheduler.startSingleTimer(0, 1000) { @@ -82,7 +82,7 @@ internal class TimerSchedulerTest { @Test fun testCancelAll() { - runBlockingSimulation { + runSimulation { val scheduler = TimerScheduler(coroutineContext, clock) scheduler.startSingleTimer(0, 1000) { fail() } @@ -93,7 +93,7 @@ internal class TimerSchedulerTest { @Test fun testOverride() { - runBlockingSimulation { + runSimulation { val scheduler = TimerScheduler(coroutineContext, clock) scheduler.startSingleTimer(0, 1000) { fail() } @@ -107,7 +107,7 @@ internal class TimerSchedulerTest { @Test fun testOverrideBlock() { - runBlockingSimulation { + runSimulation { val scheduler = TimerScheduler(coroutineContext, clock) scheduler.startSingleTimer(0, 1000) { fail() } @@ -120,7 +120,7 @@ internal class TimerSchedulerTest { @Test fun testNegativeDelay() { - runBlockingSimulation { + runSimulation { val scheduler = TimerScheduler(coroutineContext, clock) assertThrows { -- cgit v1.2.3