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

mlange-42 / ark / 13705674638

06 Mar 2025 06:31PM CUT coverage: 99.41% (+0.03%) from 99.379%
13705674638

Pull #147

github

web-flow
Merge becb7e527 into a5c169bcb
Pull Request #147: Optimize getting table from archetype

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

6237 of 6274 relevant lines covered (99.41%)

28634.75 hits per line

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

100.0
/ecs/config.go
1
package ecs
2

3
// config provides configuration for an ECS [World].
4
type config struct {
5
        // Initial capacity for archetypes and the entity index.
6
        // The default value is 128.
7
        initialCapacity int
8
        // Initial capacity for archetypes with a relation component.
9
        // The default value is initialCapacity.
10
        initialCapacityRelations int
11
}
12

13
// newConfig creates a new default [World] configuration.
14
func newConfig(initialCapacity ...int) config {
202✔
15
        switch len(initialCapacity) {
202✔
16
        case 0:
7✔
17
                return config{
7✔
18
                        initialCapacity:          1024,
7✔
19
                        initialCapacityRelations: 128,
7✔
20
                }
7✔
21
        case 1:
192✔
22
                if initialCapacity[0] < 1 {
193✔
23
                        panic("only positive values for the World's initialCapacity are allowed")
1✔
24
                }
25
                return config{
191✔
26
                        initialCapacity:          initialCapacity[0],
191✔
27
                        initialCapacityRelations: initialCapacity[0],
191✔
28
                }
191✔
29
        case 2:
2✔
30
                if initialCapacity[0] < 1 || initialCapacity[1] < 1 {
3✔
31
                        panic("only positive values for the World's initialCapacity are allowed")
1✔
32
                }
33
                return config{
1✔
34
                        initialCapacity:          initialCapacity[0],
1✔
35
                        initialCapacityRelations: initialCapacity[1],
1✔
36
                }
1✔
37
        }
38
        panic("can only use a maximum of two values for the World's initialCapacity")
1✔
39
}
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