• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Scala-Robotics-Simulator / PPS-22-srs / #495

01 Sep 2025 09:21PM UTC coverage: 54.596% (+8.1%) from 46.492%
#495

Pull #75

github

GiuliaNardicchia
refactor: enhance GridDSL to support new robot behaviors and update GridDSLTest
Pull Request #75: refactor: dsl simulation

79 of 80 new or added lines in 7 files covered. (98.75%)

18 existing lines in 2 files now uncovered.

1562 of 2861 relevant lines covered (54.6%)

7.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.0
/src/main/scala/io/github/srs/model/SimulationState.scala
1
package io.github.srs.model
2

3
import scala.concurrent.duration.{ FiniteDuration, MILLISECONDS }
4

5
import io.github.srs.model.SimulationConfig.{ SimulationSpeed, SimulationStatus }
6
import io.github.srs.model.environment.ValidEnvironment
7
import io.github.srs.utils.random.RNG
8

9
/**
10
 * Simulation state case class that holds the current state of the simulation.
11
 * @param simulationTime
12
 *   the current simulation time, if applicable.
13
 * @param elapsedTime
14
 *   the elapsed time since the start of the simulation.
15
 * @param dt
16
 *   the time step for each simulation update.
17
 * @param simulationSpeed
18
 *   the speed at which the simulation is running.
19
 * @param simulationRNG
20
 *   the random number generator used in the simulation.
21
 * @param simulationStatus
22
 *   the current status of the simulation.
23
 * @param environment
24
 *   the current environment of the simulation.
25
 */
26
final case class SimulationState(
27
    override val simulationTime: Option[FiniteDuration],
46✔
28
    override val elapsedTime: FiniteDuration = FiniteDuration(0, MILLISECONDS),
6✔
29
    override val dt: FiniteDuration = FiniteDuration(100, MILLISECONDS),
20✔
30
    override val simulationSpeed: SimulationSpeed,
20✔
31
    override val simulationRNG: RNG,
6✔
32
    override val simulationStatus: SimulationStatus,
6✔
33
    override val environment: ValidEnvironment,
6✔
34
) extends ModelModule.State
6✔
35

36
/**
37
 * Compansion methods for the [[ModelModule.State]] to provide pretty-printing functionality.
38
 */
39
object SimulationState:
NEW
40

×
41
  extension (state: ModelModule.State)
42

5✔
43
    /**
44
     * Pretty prints the simulation state in a human-readable format.
45
     * @return
46
     *   a string representation of the simulation state.
47
     */
48
    def prettyPrint: String =
49
      s"""
4✔
50
         |--- SimulationState ---
11✔
51
         | Simulation Time : ${state.simulationTime.map(t => s"${t.toMillis} ms").getOrElse("∞")}
52
         | Elapsed Time    : ${state.elapsedTime.toMillis} ms
21✔
53
         | Δt              : ${state.dt.toMillis} ms
15✔
54
         | Speed           : ${state.simulationSpeed}
15✔
55
         | RNG Seed        : ${state.simulationRNG}
9✔
56
         | Status          : ${state.simulationStatus}
9✔
57
         | Environment     : ${state.environment}
9✔
58
         |-----------------------
15✔
59
        """.stripMargin
60
end SimulationState
9✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc