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

mlange-42 / arche-model / 4733800705

18 Apr 2023 02:59PM CUT coverage: 97.196% (+0.8%) from 96.368%
4733800705

push

github

GitHub
Multi-layer Matrix and Grid observers (#39)

132 of 132 new or added lines in 5 files covered. (100.0%)

520 of 535 relevant lines covered (97.2%)

99.41 hits per line

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

100.0
/system/fixed_termination.go
1
package system
2

3
import (
4
        "github.com/mlange-42/arche-model/resource"
5
        "github.com/mlange-42/arche/ecs"
6
        "github.com/mlange-42/arche/generic"
7
)
8

9
// FixedTermination system.
10
//
11
// Terminates a model run after a fixed number of ticks.
12
//
13
// Expects a resource of type [model.Termination].
14
type FixedTermination struct {
15
        Steps   int64 // Number of simulation ticks to run.
16
        termRes generic.Resource[resource.Termination]
17
        step    int64
18
}
19

20
// Initialize the system
21
func (s *FixedTermination) Initialize(w *ecs.World) {
3✔
22
        s.termRes = generic.NewResource[resource.Termination](w)
3✔
23
        s.step = 0
3✔
24
}
3✔
25

26
// Update the system
27
func (s *FixedTermination) Update(w *ecs.World) {
230✔
28
        term := s.termRes.Get()
230✔
29

230✔
30
        if s.step+1 >= s.Steps {
233✔
31
                term.Terminate = true
3✔
32
        }
3✔
33
        s.step++
230✔
34
}
35

36
// Finalize the system
37
func (s *FixedTermination) Finalize(w *ecs.World) {}
3✔
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

© 2025 Coveralls, Inc