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

mlange-42 / arche / 4866344964

02 May 2023 10:26PM CUT coverage: 100.0%. Remained the same
4866344964

push

github

GitHub
Better document RelationsUnchecked et al. methods (#261)

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

3543 of 3543 relevant lines covered (100.0%)

1860.39 hits per line

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

100.0
/ecs/archetypes.go
1
package ecs
2

3
// Interface for an iterator over multiple archetypes.
4
type nodes interface {
5
        Get(index int32) *archetypeNode
6
        Len() int32
7
}
8

9
// Interface for an iterator over archetypes.
10
type archetypes interface {
11
        Get(index int32) *archetype
12
        Len() int32
13
}
14

15
// Implementation of an archetype iterator for a single archetype.
16
// Implements [archetypes].
17
//
18
// Used for the [Query] returned by entity batch creation methods.
19
type batchArchetype struct {
20
        Archetype  *archetype
21
        StartIndex uint32
22
}
23

24
// Get returns the value at the given index.
25
func (s batchArchetype) Get(index int32) *archetype {
511✔
26
        return s.Archetype
511✔
27
}
511✔
28

29
// Len returns the current number of items in the paged array.
30
func (s batchArchetype) Len() int32 {
1,695✔
31
        return 1
1,695✔
32
}
1,695✔
33

34
// Implementation of an archetype iterator for pointers.
35
// Implements [archetypes].
36
//
37
// Used for tracking filter archetypes in [Cache].
38
type archetypePointers struct {
39
        pointers []*archetype
40
}
41

42
// Get returns the value at the given index.
43
func (a *archetypePointers) Get(index int32) *archetype {
22✔
44
        return a.pointers[index]
22✔
45
}
22✔
46

47
// Add an element.
48
func (a *archetypePointers) Add(arch *archetype) {
22✔
49
        a.pointers = append(a.pointers, arch)
22✔
50
}
22✔
51

52
// Remove an element.
53
func (a *archetypePointers) Remove(arch *archetype) {
2✔
54
        ln := len(a.pointers)
2✔
55
        for i := 0; i < ln; i++ {
5✔
56
                arch2 := a.pointers[i]
3✔
57
                if arch == arch2 {
5✔
58
                        a.pointers[i], a.pointers[ln-1] = a.pointers[ln-1], nil
2✔
59
                        a.pointers = a.pointers[:ln-1]
2✔
60
                        return
2✔
61
                }
2✔
62
        }
63
}
64

65
// Len returns the current number of items in the paged array.
66
func (a *archetypePointers) Len() int32 {
22✔
67
        return int32(len(a.pointers))
22✔
68
}
22✔
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