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

mlange-42 / arche-model / 4731229459

18 Apr 2023 10:20AM CUT coverage: 96.368% (+0.2%) from 96.144%
4731229459

push

github

GitHub
Single grid coords & MatrixToGrid observer (#38)

24 of 24 new or added lines in 1 file covered. (100.0%)

398 of 413 relevant lines covered (96.37%)

127.65 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