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

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

25 Jul 2025 04:26PM UTC coverage: 65.789% (-2.1%) from 67.873%
#93

push

github

GiuliaNardicchia
refactor: update Controller, Model, View modules to support generic state management and app simulationLoop function

0 of 24 new or added lines in 6 files covered. (0.0%)

7 existing lines in 5 files now uncovered.

150 of 228 relevant lines covered (65.79%)

8.86 hits per line

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

0.0
/src/main/scala/io/github/srs/controller/ControllerModule.scala
1
package io.github.srs.controller
2

3
import io.github.srs.model.ModelModule
4

5
object ControllerModule:
6

×
7
  trait Controller[S <: ModelModule.State]:
NEW
8
    def start(initialState: S): Unit
×
9
    def simulationLoop(s: S): Unit
10

11
  trait Provider[S <: ModelModule.State]:
12
    val controller: Controller[S]
13

14
  type Requirements[S <: ModelModule.State] =
15
    io.github.srs.view.ViewModule.Provider[S] & io.github.srs.model.ModelModule.Provider[S]
16

17
  trait Component[S <: ModelModule.State]:
NEW
18
    context: Requirements[S] =>
×
19

20
    object Controller:
NEW
21
      def apply(): Controller[S] = new ControllerImpl
×
22

×
23
      private class ControllerImpl extends Controller[S]:
24

×
25
        override def start(initialState: S): Unit =
26
          context.view.init()
×
NEW
27
          simulationLoop(initialState)
×
NEW
28

×
29
        @annotation.tailrec
NEW
30
        override final def simulationLoop(s: S): Unit =
×
NEW
31
          val state = for
×
NEW
32
            newState <- context.model.update(s)
×
NEW
33
            _ <- Some(context.view.render(newState))
×
34
          yield newState
NEW
35

×
36
          state match
NEW
37
            case Some(ns) => simulationLoop(ns)
×
NEW
38
            case None => ()
×
UNCOV
39

×
40
  end Component
41

42
  trait Interface[S <: ModelModule.State] extends Provider[S] with Component[S]:
43
    self: Requirements[S] =>
44
end ControllerModule
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