github.com/weaviate/weaviate@v1.24.6/adapters/repos/db/vector/hnsw/distancer/geo_spatial_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 distancer 13 14 import ( 15 "testing" 16 17 "github.com/stretchr/testify/assert" 18 "github.com/stretchr/testify/require" 19 ) 20 21 func TestGeoSpatialDistance(t *testing.T) { 22 t.Run("between Munich and Stuttgart", func(t *testing.T) { 23 munich := []float32{48.137154, 11.576124} 24 stuttgart := []float32{48.783333, 9.183333} 25 26 dist, ok, err := NewGeoProvider().New(munich).Distance(stuttgart) 27 require.Nil(t, err) 28 require.True(t, ok) 29 assert.InDelta(t, 190000, dist, 1000) 30 }) 31 }