• 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
/reporter/print.go
1
package reporter
2

3
import (
4
        "fmt"
5

6
        "github.com/mlange-42/arche-model/observer"
7
        "github.com/mlange-42/arche/ecs"
8
)
9

10
// Print reporter to print a table row per time step.
11
type Print struct {
12
        Observer       observer.Row // Observer to get data from.
13
        UpdateInterval int          // Update/print interval in model ticks.
14
        header         []string
15
        step           int64
16
}
17

18
// Initialize the system
19
func (s *Print) Initialize(w *ecs.World) {
1✔
20
        s.Observer.Initialize(w)
1✔
21
        s.header = s.Observer.Header()
1✔
22
        s.step = 0
1✔
23
}
1✔
24

25
// Update the system
26
func (s *Print) Update(w *ecs.World) {
20✔
27
        s.Observer.Update(w)
20✔
28
        if s.step%int64(s.UpdateInterval) == 0 {
22✔
29
                values := s.Observer.Values(w)
2✔
30
                fmt.Printf("%v\n%v\n", s.header, values)
2✔
31
        }
2✔
32
        s.step++
20✔
33
}
34

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