Skip to content

Commit

Permalink
Added tests for Slice method
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Jun 4, 2024
1 parent 76c5936 commit bafc9b7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions halfvec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ func TestHalfVectorString(t *testing.T) {
}
}

func TestHalfVectorSlice(t *testing.T) {
vec := pgvector.NewHalfVector([]float32{1, 2, 3})
if !reflect.DeepEqual(vec.Slice(), []float32{1, 2, 3}) {
t.Errorf("Bad slice")
}
}

func TestHalfVectorMarshal(t *testing.T) {
vec := pgvector.NewHalfVector([]float32{1, 2, 3})
data, err := json.Marshal(vec)
Expand Down
7 changes: 7 additions & 0 deletions vector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ func TestVectorString(t *testing.T) {
}
}

func TestVectorSlice(t *testing.T) {
vec := pgvector.NewVector([]float32{1, 2, 3})
if !reflect.DeepEqual(vec.Slice(), []float32{1, 2, 3}) {
t.Errorf("Bad slice")
}
}

func TestVectorMarshal(t *testing.T) {
vec := pgvector.NewVector([]float32{1, 2, 3})
data, err := json.Marshal(vec)
Expand Down

0 comments on commit bafc9b7

Please sign in to comment.