From 1f24c38013a6bcdb8cabb2af4d6884e477eb1957 Mon Sep 17 00:00:00 2001 From: vdaas-ci <57942646+vdaas-ci@users.noreply.github.com> Date: Wed, 11 Sep 2024 11:22:00 +0900 Subject: [PATCH] Refactor test checkFunc condition (#2599) (#2602) * :bug: :white_check_mark: Fix checkFun condition * :recycle: Fix by feedback * :recycle: Fix by feedback --------- Signed-off-by: vankichi Co-authored-by: Kiichiro YUKAWA --- internal/test/data/vector/gen_test.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/internal/test/data/vector/gen_test.go b/internal/test/data/vector/gen_test.go index 24f1c11bee..4f3049b4ae 100644 --- a/internal/test/data/vector/gen_test.go +++ b/internal/test/data/vector/gen_test.go @@ -47,8 +47,13 @@ func TestFloat32VectorGenerator(t *testing.T) { } if got != nil { vectors := got(a.n, a.dim) - if len(vectors) != w.n && len(vectors[0]) != w.dim { - return errors.Errorf("got: \"%d\",\"%d\"\n\t\t\t\twant: \"%d\",\"%d\"", len(vectors), len(vectors[0]), w.n, w.dim) + if len(vectors) != w.n { + return errors.Errorf("got: \"%#v\",\n\t\t\t\twantLen: \"%#v\"", len(vectors), w.n) + } + for _, vec := range vectors { + if len(vec) != w.dim { + return errors.Errorf("got: \"%#v\",\n\t\t\t\twantDim: \"%#v\"", len(vec), w.dim) + } } } return nil @@ -140,8 +145,13 @@ func TestUint8VectorGenerator(t *testing.T) { } if got != nil { vectors := got(a.n, a.dim) - if len(vectors) != w.n && len(vectors[0]) != w.dim { - return errors.Errorf("got: \"%d\",\"%d\"\n\t\t\t\twant: \"%d\",\"%d\"", len(vectors), len(vectors[0]), w.n, w.dim) + if len(vectors) != w.n { + return errors.Errorf("got: \"%#v\",\n\t\t\t\twantLen: \"%#v\"", len(vectors), w.n) + } + for _, vec := range vectors { + if len(vec) != w.dim { + return errors.Errorf("got: \"%#v\",\n\t\t\t\twantDim: \"%#v\"", len(vec), w.dim) + } } } return nil