Skip to content

Commit

Permalink
test(cardinal): write tests for cardinal search.go to maintain api (#387
Browse files Browse the repository at this point in the history
)
  • Loading branch information
pyrofolium authored Nov 3, 2023
1 parent 011a331 commit e874637
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
3 changes: 3 additions & 0 deletions cardinal/component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ func TestComponentExample(t *testing.T) {
count, err = search.Count(testWorldCtx)
assert.NilError(t, err)
assert.Equal(t, len(peopleIDs)-1, count)
first, err := search.First(testWorldCtx)
assert.NilError(t, err)
assert.Equal(t, first, cardinal.EntityID(0))

// Age does not exist on the target ID, so this should result in an error
err = cardinal.UpdateComponent[Age](testWorldCtx, targetID, func(a *Age) *Age {
Expand Down
9 changes: 0 additions & 9 deletions cardinal/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ type Search struct {
impl *ecs.Search
}

// NewSearch creates a new Search.
func (w *World) NewSearch(filter Filter) (*Search, error) {
q, err := w.implWorld.NewSearch(filter.convertToFilterable())
if err != nil {
return nil, err
}
return &Search{q}, nil
}

// SearchCallBackFn represents a function that can operate on a single EntityID, and returns whether the next EntityID
// should be processed.
type SearchCallBackFn func(EntityID) bool
Expand Down

0 comments on commit e874637

Please sign in to comment.