Skip to content

Commit

Permalink
Merge pull request #41 from philippgille/fix-filter-test
Browse files Browse the repository at this point in the history
Fix filter test
  • Loading branch information
philippgille authored Mar 5, 2024
2 parents d2d642d + 3ed53b4 commit fa85ba6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package chromem

import (
"reflect"
"slices"
"testing"
)

Expand Down Expand Up @@ -92,6 +93,14 @@ func TestFilterDocs(t *testing.T) {
got := filterDocs(docs, tc.where, tc.whereDocument)

if !reflect.DeepEqual(got, tc.want) {
// If len is 2, the order might be different (function under test
// is concurrent and order is not guaranteed).
if len(got) == 2 && len(tc.want) == 2 {
slices.Reverse(got)
if reflect.DeepEqual(got, tc.want) {
return
}
}
t.Fatalf("got %v; want %v", got, tc.want)
}
})
Expand Down

0 comments on commit fa85ba6

Please sign in to comment.