Skip to content

Commit

Permalink
✅ Fix unit test
Browse files Browse the repository at this point in the history
Signed-off-by: vankichi <kyukawa315@gmail.com>
  • Loading branch information
vankichi committed Dec 20, 2024
1 parent 589be29 commit 6123856
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions internal/core/algorithm/ngt/ngt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2306,7 +2306,8 @@ func Test_ngt_InsertCommit(t *testing.T) {
{
name: "return object id when object type is uint8",
args: args{
vec: []float32{0, 1, 2, 3, 4, 5, 6, 7, 8},
vec: []float32{0, 1, 2, 3, 4, 5, 6, 7, 8},
poolSize: uint32(1),
},
fields: fields{
idxPath: idxTempDir(t),
Expand All @@ -2321,7 +2322,8 @@ func Test_ngt_InsertCommit(t *testing.T) {
{
name: "return object id when object type is uint8 and all vector elem are 0",
args: args{
vec: []float32{0, 0, 0, 0, 0, 0, 0, 0, 0},
vec: []float32{0, 0, 0, 0, 0, 0, 0, 0, 0},
poolSize: uint32(1),
},
fields: fields{
idxPath: idxTempDir(t),
Expand All @@ -2340,6 +2342,7 @@ func Test_ngt_InsertCommit(t *testing.T) {
math.MinInt8, math.MinInt8, math.MinInt8, math.MinInt8,
math.MinInt8, math.MinInt8, math.MinInt8, math.MinInt8, math.MinInt8,
},
poolSize: uint32(1),
},
fields: fields{
idxPath: idxTempDir(t),
Expand All @@ -2358,6 +2361,7 @@ func Test_ngt_InsertCommit(t *testing.T) {
math.MaxUint8, math.MaxUint8, math.MaxUint8, math.MaxUint8,
math.MaxUint8, math.MaxUint8, math.MaxUint8, math.MaxUint8, math.MaxUint8,
},
poolSize: uint32(1),
},
fields: fields{
idxPath: idxTempDir(t),
Expand All @@ -2372,7 +2376,8 @@ func Test_ngt_InsertCommit(t *testing.T) {
{
name: "return object id when object type is float",
args: args{
vec: []float32{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8},
vec: []float32{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8},
poolSize: uint32(1),
},
fields: fields{
idxPath: idxTempDir(t),
Expand All @@ -2387,7 +2392,8 @@ func Test_ngt_InsertCommit(t *testing.T) {
{
name: "return object id when object type is float and all vector elem are 0",
args: args{
vec: []float32{0, 0, 0, 0, 0, 0, 0, 0, 0},
vec: []float32{0, 0, 0, 0, 0, 0, 0, 0, 0},
poolSize: uint32(1),
},
fields: fields{
idxPath: idxTempDir(t),
Expand All @@ -2406,6 +2412,7 @@ func Test_ngt_InsertCommit(t *testing.T) {
math.SmallestNonzeroFloat32, math.SmallestNonzeroFloat32, math.SmallestNonzeroFloat32, math.SmallestNonzeroFloat32,
math.SmallestNonzeroFloat32, math.SmallestNonzeroFloat32, math.SmallestNonzeroFloat32, math.SmallestNonzeroFloat32, math.SmallestNonzeroFloat32,
},
poolSize: uint32(1),
},
fields: fields{
idxPath: idxTempDir(t),
Expand All @@ -2424,6 +2431,7 @@ func Test_ngt_InsertCommit(t *testing.T) {
math.MaxFloat32, math.MaxFloat32, math.MaxFloat32, math.MaxFloat32,
math.MaxFloat32, math.MaxFloat32, math.MaxFloat32, math.MaxFloat32, math.MaxFloat32,
},
poolSize: uint32(1),
},
fields: fields{
idxPath: idxTempDir(t),
Expand All @@ -2438,7 +2446,8 @@ func Test_ngt_InsertCommit(t *testing.T) {
{
name: "return error if dimension is not the same as insert vector",
args: args{
vec: []float32{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8},
vec: []float32{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8},
poolSize: uint32(1),
},
fields: fields{
idxPath: idxTempDir(t),
Expand Down Expand Up @@ -2890,6 +2899,7 @@ func Test_ngt_BulkInsertCommit(t *testing.T) {
vecs: [][]float32{
{0, 1, 2, 3, 4, 5, 6, 7, 8},
},
poolSize: uint32(1),
},
fields: fields{
idxPath: idxTempDir(t),
Expand All @@ -2913,6 +2923,7 @@ func Test_ngt_BulkInsertCommit(t *testing.T) {
{3, 4, 5, 6, 7, 8, 9, 10, 11},
{4, 5, 6, 7, 8, 9, 10, 11, 12},
},
poolSize: uint32(1),
},
fields: fields{
idxPath: idxTempDir(t),
Expand All @@ -2933,6 +2944,7 @@ func Test_ngt_BulkInsertCommit(t *testing.T) {
{0, 1, 2, 3, 4, 5, 6, 7, 8},
{0, 1, 2, 3, 4, 5, 6, 7, 8},
},
poolSize: uint32(1),
},
fields: fields{
idxPath: idxTempDir(t),
Expand All @@ -2955,6 +2967,7 @@ func Test_ngt_BulkInsertCommit(t *testing.T) {
{0, 1, 2, 3, 4, 5, 6, 7},
{0, 1, 2, 3, 4, 5, 6, 7, 8, 10},
},
poolSize: uint32(1),
},
fields: fields{
idxPath: idxTempDir(t),
Expand All @@ -2978,6 +2991,7 @@ func Test_ngt_BulkInsertCommit(t *testing.T) {
vecs: [][]float32{
{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8},
},
poolSize: uint32(1),
},
fields: fields{
idxPath: idxTempDir(t),
Expand All @@ -3001,6 +3015,7 @@ func Test_ngt_BulkInsertCommit(t *testing.T) {
{0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.10, 0.11},
{0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.10, 0.11, 0.12},
},
poolSize: uint32(1),
},
fields: fields{
idxPath: idxTempDir(t),
Expand All @@ -3021,6 +3036,7 @@ func Test_ngt_BulkInsertCommit(t *testing.T) {
{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8},
{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8},
},
poolSize: uint32(1),
},
fields: fields{
idxPath: idxTempDir(t),
Expand All @@ -3043,6 +3059,7 @@ func Test_ngt_BulkInsertCommit(t *testing.T) {
{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7},
{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.10},
},
poolSize: uint32(1),
},
fields: fields{
idxPath: idxTempDir(t),
Expand Down

0 comments on commit 6123856

Please sign in to comment.