Skip to content

Commit 33ff897

Browse files
Merge pull request #220 from codecrafters-io/redis-geospatial-updates
Updates after testing
2 parents bb1cac0 + 81ce73e commit 33ff897

File tree

7 files changed

+151
-146
lines changed

7 files changed

+151
-146
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ test_all_with_redis:
9696
make test_list_with_redis || true
9797
make test_pubsub_with_redis || true
9898
make test_zset_with_redis || true
99+
make test_geospatial_with_redis || true
99100

100101
setup:
101102
echo "Setting up redis-tester prerequisites for Linux"

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.24
55
toolchain go1.24.2
66

77
require (
8-
github.com/codecrafters-io/tester-utils v0.4.8-0.20250822020829-f572c78c46fc
8+
github.com/codecrafters-io/tester-utils v0.4.8
99
github.com/hdt3213/rdb v1.2.0
1010
github.com/stretchr/testify v1.10.0
1111
github.com/tidwall/pretty v1.2.1
@@ -19,7 +19,7 @@ require (
1919
github.com/mattn/go-isatty v0.0.20 // indirect
2020
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
2121
github.com/pmezard/go-difflib v1.0.0 // indirect
22-
golang.org/x/sys v0.33.0 // indirect
22+
golang.org/x/sys v0.35.0 // indirect
2323
gopkg.in/yaml.v2 v2.4.0 // indirect
2424
)
2525

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F
66
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
77
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
88
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
9-
github.com/codecrafters-io/tester-utils v0.4.8-0.20250822020829-f572c78c46fc h1:IeVtegwreCuVUvx7THUROaEUEyNkM7pGMjvYBK6ImLU=
10-
github.com/codecrafters-io/tester-utils v0.4.8-0.20250822020829-f572c78c46fc/go.mod h1:Fyrv4IebzjWtvKfpYf8ooYDoOtjYe2qx8bV7KAJpX+w=
9+
github.com/codecrafters-io/tester-utils v0.4.8 h1:+37SwsQ93ni+Tkz1/tNoDuqYbhvOS0nsbdeJrzRumpc=
10+
github.com/codecrafters-io/tester-utils v0.4.8/go.mod h1:Fyrv4IebzjWtvKfpYf8ooYDoOtjYe2qx8bV7KAJpX+w=
1111
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1212
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1313
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -43,8 +43,8 @@ golang.org/x/arch v0.9.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
4343
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4444
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4545
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
46-
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
47-
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
46+
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
47+
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
4848
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
4949
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
5050
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=

internal/resp/value/value.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ func (v Value) ToSerializable() interface{} {
138138
switch v.Type {
139139
case BULK_STRING:
140140
return v.String()
141+
case NIL:
142+
return "$-1\r\n"
143+
case NIL_ARRAY:
144+
return "*-1\r\n"
141145
case INTEGER:
142146
return v.Integer()
143147
case ARRAY:

internal/test_cases/geodist_test_case.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func (t *GeoDistTestCase) Run(client *instrumented_resp_connection.InstrumentedR
2020
geodistTestCase := SendCommandTestCase{
2121
Command: "GEODIST",
2222
Args: []string{t.Key, t.Location1.Name, t.Location2.Name},
23-
Assertion: resp_assertions.NewFloatingPointBulkStringAssertion(distance, 10e-4),
23+
Assertion: resp_assertions.NewFloatingPointBulkStringAssertion(distance, 1e-4),
2424
}
2525

2626
return geodistTestCase.Run(client, logger)

internal/test_cases/geopos_test_case.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (t *GeoPosTestCase) Run(client *instrumented_resp_connection.InstrumentedRe
6868

6969
// Assertions for existing locations
7070
for _, location := range t.Locations {
71-
tolerance := 10e-6
71+
tolerance := 1e-6
7272

7373
if t.ShouldSkipCoordinatesVerfication {
7474
tolerance = math.Inf(1)

0 commit comments

Comments
 (0)