MCPcopy Create free account
hub / github.com/acl-dev/acl / test_geodist

Function test_geodist

lib_acl_cpp/samples/redis/redis_geo/redis_geo.cpp:129–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129static bool test_geodist(acl::redis& redis, int n)
130{
131 acl::string key;
132 acl::string member1("member_0"), member2("member_1");
133
134 for (int i = 0; i < n; i++)
135 {
136 redis.clear();
137 key.format("%s_%d", __keypre.c_str(), i);
138 double ret = redis.geodist(key.c_str(), member1.c_str(),
139 member2.c_str());
140 if (ret < 0)
141 {
142 printf("geodist error: %s, key: %s\r\n",
143 redis.result_error(), key.c_str());
144 return false;
145 }
146 else if (i >= 10)
147 continue;
148
149 printf("ok, key: %s, dist: %.8f between %s and %s\r\n",
150 key.c_str(), ret, member1.c_str(), member2.c_str());
151 }
152
153 return true;
154}
155
156static bool test_georadius(acl::redis& redis, int n)
157{

Callers 1

mainFunction · 0.85

Calls 5

geodistMethod · 0.80
result_errorMethod · 0.80
clearMethod · 0.45
formatMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…