github.com/weaviate/weaviate@v1.24.6/adapters/repos/db/vector/hnsw/search_by_dist_test.go (about)

     1  //                           _       _
     2  // __      _____  __ ___   ___  __ _| |_ ___
     3  // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
     4  //  \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
     5  //   \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
     6  //
     7  //  Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
     8  //
     9  //  CONTACT: hello@weaviate.io
    10  //
    11  
    12  package hnsw
    13  
    14  import (
    15  	"testing"
    16  
    17  	"github.com/stretchr/testify/assert"
    18  )
    19  
    20  func TestSearchByDistParams(t *testing.T) {
    21  	t.Run("param iteration", func(t *testing.T) {
    22  		params := newSearchByDistParams(100)
    23  		assert.Equal(t, 0, params.offset)
    24  		assert.Equal(t, DefaultSearchByDistInitialLimit, params.limit)
    25  		assert.Equal(t, 100, params.totalLimit)
    26  
    27  		params.iterate()
    28  		assert.Equal(t, 100, params.offset)
    29  		assert.Equal(t, 1000, params.limit)
    30  		assert.Equal(t, 1100, params.totalLimit)
    31  	})
    32  }