From 0549774b0b7a3a79bb84b69f767dabcfbe80152b Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Mon, 3 Jun 2024 23:04:09 -0700 Subject: [PATCH] Moved tests [skip ci] --- halfvec_test.go | 12 ++++++------ sparsevec_test.go | 12 ++++++------ vector_test.go | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/halfvec_test.go b/halfvec_test.go index 6fcb4e0..04c7e76 100644 --- a/halfvec_test.go +++ b/halfvec_test.go @@ -9,17 +9,17 @@ import ( "github.com/pgvector/pgvector-go" ) -func TestHalfVectorString(t *testing.T) { +func TestHalfVectorSlice(t *testing.T) { vec := pgvector.NewHalfVector([]float32{1, 2, 3}) - if fmt.Sprint(vec) != "[1,2,3]" { - t.Errorf("Bad string") + if !reflect.DeepEqual(vec.Slice(), []float32{1, 2, 3}) { + t.Errorf("Bad slice") } } -func TestHalfVectorSlice(t *testing.T) { +func TestHalfVectorString(t *testing.T) { vec := pgvector.NewHalfVector([]float32{1, 2, 3}) - if !reflect.DeepEqual(vec.Slice(), []float32{1, 2, 3}) { - t.Errorf("Bad slice") + if fmt.Sprint(vec) != "[1,2,3]" { + t.Errorf("Bad string") } } diff --git a/sparsevec_test.go b/sparsevec_test.go index b57d890..9232e41 100644 --- a/sparsevec_test.go +++ b/sparsevec_test.go @@ -8,16 +8,16 @@ import ( "github.com/pgvector/pgvector-go" ) -func TestSparseVectorString(t *testing.T) { +func TestSparseVectorSlice(t *testing.T) { vec := pgvector.NewSparseVector([]float32{1, 0, 2, 0, 3, 0}) - if fmt.Sprint(vec) != "{1:1,3:2,5:3}/6" { - t.Errorf("Bad string") + if !reflect.DeepEqual(vec.Slice(), []float32{1, 0, 2, 0, 3, 0}) { + t.Errorf("Bad slice") } } -func TestSparseVectorSlice(t *testing.T) { +func TestSparseVectorString(t *testing.T) { vec := pgvector.NewSparseVector([]float32{1, 0, 2, 0, 3, 0}) - if !reflect.DeepEqual(vec.Slice(), []float32{1, 0, 2, 0, 3, 0}) { - t.Errorf("Bad slice") + if fmt.Sprint(vec) != "{1:1,3:2,5:3}/6" { + t.Errorf("Bad string") } } diff --git a/vector_test.go b/vector_test.go index c8e6cfd..6db56ea 100644 --- a/vector_test.go +++ b/vector_test.go @@ -9,17 +9,17 @@ import ( "github.com/pgvector/pgvector-go" ) -func TestVectorString(t *testing.T) { +func TestVectorSlice(t *testing.T) { vec := pgvector.NewVector([]float32{1, 2, 3}) - if fmt.Sprint(vec) != "[1,2,3]" { - t.Errorf("Bad string") + if !reflect.DeepEqual(vec.Slice(), []float32{1, 2, 3}) { + t.Errorf("Bad slice") } } -func TestVectorSlice(t *testing.T) { +func TestVectorString(t *testing.T) { vec := pgvector.NewVector([]float32{1, 2, 3}) - if !reflect.DeepEqual(vec.Slice(), []float32{1, 2, 3}) { - t.Errorf("Bad slice") + if fmt.Sprint(vec) != "[1,2,3]" { + t.Errorf("Bad string") } }