| 127 | } |
| 128 | |
| 129 | static 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 | |
| 156 | static bool test_georadius(acl::redis& redis, int n) |
| 157 | { |