| 221 | } |
| 222 | |
| 223 | int main(int argc, char* argv[]) |
| 224 | { |
| 225 | int ch, n = 1, conn_timeout = 10, rw_timeout = 10; |
| 226 | acl::string addr("127.0.0.1:6379"), cmd; |
| 227 | |
| 228 | while ((ch = getopt(argc, argv, "hs:n:C:T:a:")) > 0) |
| 229 | { |
| 230 | switch (ch) |
| 231 | { |
| 232 | case 'h': |
| 233 | usage(argv[0]); |
| 234 | return 0; |
| 235 | case 's': |
| 236 | addr = optarg; |
| 237 | break; |
| 238 | case 'n': |
| 239 | n = atoi(optarg); |
| 240 | break; |
| 241 | case 'C': |
| 242 | conn_timeout = atoi(optarg); |
| 243 | break; |
| 244 | case 'T': |
| 245 | rw_timeout = atoi(optarg); |
| 246 | break; |
| 247 | case 'a': |
| 248 | cmd = optarg; |
| 249 | break; |
| 250 | default: |
| 251 | break; |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | acl::acl_cpp_init(); |
| 256 | |
| 257 | acl::redis_client_cluster cluster; |
| 258 | cluster.set(addr.c_str(), 100, conn_timeout, rw_timeout); |
| 259 | |
| 260 | acl::redis redis; |
| 261 | redis.set_cluster(&cluster); |
| 262 | |
| 263 | bool ret; |
| 264 | |
| 265 | if (cmd == "geoadd") |
| 266 | ret = test_geoadd(redis, n); |
| 267 | else if (cmd == "geohash") |
| 268 | ret = test_geohash(redis, n); |
| 269 | else if (cmd == "geopos") |
| 270 | ret = test_geopos(redis, n); |
| 271 | else if (cmd == "geodist") |
| 272 | ret = test_geodist(redis, n); |
| 273 | else if (cmd == "georadius") |
| 274 | ret = test_georadius(redis, n); |
| 275 | else if (cmd == "georadiusbymember") |
| 276 | ret = test_georadiusbymember(redis, n); |
| 277 | else if (cmd == "all") |
| 278 | { |
| 279 | ret = test_geoadd(redis, n) |
| 280 | && test_geohash(redis, n) |
nothing calls this directly
no test coverage detected
searching dependent graphs…