From 9b17c40788bce8eb984e3deabaea89eb9e8b8d93 Mon Sep 17 00:00:00 2001 From: Sergey Avseyev Date: Fri, 13 Jan 2012 14:26:53 +0300 Subject: [PATCH] Make tests c89 friendly Change-Id: I92c7460b94b914b3bd8be60d285c0fde4b876222 Reviewed-on: http://review.couchbase.org/12336 Reviewed-by: Dustin Sallings Tested-by: Dustin Sallings --- tests/config/testapp-config | 15 ++ tests/config/testapp-config-couch-api-base | 55 ++++ tests/config/testapp-config-diff1 | 15 ++ tests/config/testapp-config-diff2 | 15 ++ tests/config/testapp-config-diff3 | 18 ++ tests/config/testapp-config-flat | 15 ++ tests/config/testapp-config-in-envelope | 18 ++ tests/config/testapp-config-in-envelope-fft | 25 ++ tests/config/testapp-config-in-envelope2 | 48 ++++ tests/config/testapp-config-user-password1 | 17 ++ tests/config/testapp-config-user-password2 | 17 ++ tests/macros.h | 14 + tests/regression.c | 3 +- tests/testapp.c | 285 +++----------------- tests/testketama.c | 2 +- 15 files changed, 310 insertions(+), 252 deletions(-) create mode 100644 tests/config/testapp-config create mode 100644 tests/config/testapp-config-couch-api-base create mode 100644 tests/config/testapp-config-diff1 create mode 100644 tests/config/testapp-config-diff2 create mode 100644 tests/config/testapp-config-diff3 create mode 100644 tests/config/testapp-config-flat create mode 100644 tests/config/testapp-config-in-envelope create mode 100644 tests/config/testapp-config-in-envelope-fft create mode 100644 tests/config/testapp-config-in-envelope2 create mode 100644 tests/config/testapp-config-user-password1 create mode 100644 tests/config/testapp-config-user-password2 create mode 100644 tests/macros.h diff --git a/tests/config/testapp-config b/tests/config/testapp-config new file mode 100644 index 0000000..61e5944 --- /dev/null +++ b/tests/config/testapp-config @@ -0,0 +1,15 @@ +{ + "hashAlgorithm": "CRC", + "numReplicas": 2, + "serverList": [ + "server1:11211", + "server2:11210", + "server3:11211" + ], + "vBucketMap": [ + [ 0, 1, 2 ], + [ 1, 2, 0 ], + [ 2, 1, -1 ], + [ 1, 2, 0 ] + ] +} diff --git a/tests/config/testapp-config-couch-api-base b/tests/config/testapp-config-couch-api-base new file mode 100644 index 0000000..bd360ac --- /dev/null +++ b/tests/config/testapp-config-couch-api-base @@ -0,0 +1,55 @@ +{ + "nodes": [ + { + "hostname": "192.168.2.123:9002", + "couchApiBase": "http://192.168.2.123:9502/default", + "ports": { + "proxy": 12005, + "direct": 12004 + } + }, + { + "hostname": "192.168.2.123:9000", + "couchApiBase": "http://192.168.2.123:9500/default", + "ports": { + "proxy": 12001, + "direct": 12000 + } + }, + { + "hostname": "192.168.2.123:9001", + "couchApiBase": "http://192.168.2.123:9501/default", + "ports": { + "proxy": 12003, + "direct": 12002 + } + } + ], + "vBucketServerMap": { + "hashAlgorithm": "CRC", + "numReplicas": 1, + "serverList": [ + "192.168.2.123:12000", + "192.168.2.123:12002", + "192.168.2.123:12004" + ], + "vBucketMap": [ + [ 0, 1 ], + [ 0, 1 ], + [ 0, 1 ], + [ 1, 2 ], + [ 1, 2 ], + [ 2, 0 ], + [ 2, 1 ], + [ 2, 1 ], + [ 1, 0 ], + [ 1, 0 ], + [ 1, 0 ], + [ 0, 2 ], + [ 0, 2 ], + [ 0, 2 ], + [ 2, 0 ], + [ 2, 0 ] + ] + } +} diff --git a/tests/config/testapp-config-diff1 b/tests/config/testapp-config-diff1 new file mode 100644 index 0000000..61e5944 --- /dev/null +++ b/tests/config/testapp-config-diff1 @@ -0,0 +1,15 @@ +{ + "hashAlgorithm": "CRC", + "numReplicas": 2, + "serverList": [ + "server1:11211", + "server2:11210", + "server3:11211" + ], + "vBucketMap": [ + [ 0, 1, 2 ], + [ 1, 2, 0 ], + [ 2, 1, -1 ], + [ 1, 2, 0 ] + ] +} diff --git a/tests/config/testapp-config-diff2 b/tests/config/testapp-config-diff2 new file mode 100644 index 0000000..6199f45 --- /dev/null +++ b/tests/config/testapp-config-diff2 @@ -0,0 +1,15 @@ +{ + "hashAlgorithm": "CRC", + "numReplicas": 2, + "serverList": [ + "server1:11211", + "server2:11210", + "server4:11211" + ], + "vBucketMap": [ + [ 0, 1, 2 ], + [ 1, 2, 0 ], + [ 2, 1, -1 ], + [ 0, 2, 0 ] + ] +} diff --git a/tests/config/testapp-config-diff3 b/tests/config/testapp-config-diff3 new file mode 100644 index 0000000..fd62237 --- /dev/null +++ b/tests/config/testapp-config-diff3 @@ -0,0 +1,18 @@ +{ + "hashAlgorithm": "CRC", + "numReplicas": 1, + "serverList": [ + "server1:11211", + "server2:11210" + ], + "vBucketMap": [ + [ 0, 1 ], + [ 1, 0 ], + [ 1, 0 ], + [ 0, 1 ], + [ 0, 1 ], + [ 1, 0 ], + [ 1, 0 ], + [ 0, 1 ] + ] +} diff --git a/tests/config/testapp-config-flat b/tests/config/testapp-config-flat new file mode 100644 index 0000000..61e5944 --- /dev/null +++ b/tests/config/testapp-config-flat @@ -0,0 +1,15 @@ +{ + "hashAlgorithm": "CRC", + "numReplicas": 2, + "serverList": [ + "server1:11211", + "server2:11210", + "server3:11211" + ], + "vBucketMap": [ + [ 0, 1, 2 ], + [ 1, 2, 0 ], + [ 2, 1, -1 ], + [ 1, 2, 0 ] + ] +} diff --git a/tests/config/testapp-config-in-envelope b/tests/config/testapp-config-in-envelope new file mode 100644 index 0000000..eeb7167 --- /dev/null +++ b/tests/config/testapp-config-in-envelope @@ -0,0 +1,18 @@ +{ + "otherKeyThatIsIgnored": 12345, + "vBucketServerMap": { + "hashAlgorithm": "CRC", + "numReplicas": 2, + "serverList": [ + "server1:11211", + "server2:11210", + "server3:11211" + ], + "vBucketMap": [ + [ 0, 1, 2 ], + [ 1, 2, 0 ], + [ 2, 1, -1 ], + [ 1, 2, 0 ] + ] + } +} diff --git a/tests/config/testapp-config-in-envelope-fft b/tests/config/testapp-config-in-envelope-fft new file mode 100644 index 0000000..85666df --- /dev/null +++ b/tests/config/testapp-config-in-envelope-fft @@ -0,0 +1,25 @@ +{ + "otherKeyThatIsIgnored": 12345, + "vBucketServerMap": { + "hashAlgorithm": "CRC", + "numReplicas": 2, + "serverList": [ + "server1:11211", + "server2:11210", + "server3:11211", + "server4:11211" + ], + "vBucketMap": [ + [ 0, 1, 2 ], + [ 1, 2, 0 ], + [ 2, 1, -1 ], + [ 1, 2, 0 ] + ], + "vBucketMapForward": [ + [ 3, 0, 0 ], + [ 2, 1, 3 ], + [ 1, 2, 2 ], + [ 0, 3, 1 ] + ] + } +} diff --git a/tests/config/testapp-config-in-envelope2 b/tests/config/testapp-config-in-envelope2 new file mode 100644 index 0000000..0365c7c --- /dev/null +++ b/tests/config/testapp-config-in-envelope2 @@ -0,0 +1,48 @@ +{ + "name": "default", + "uri": "/pools/default/buckets/default", + "streamingUri": "/pools/default/bucketsStreaming/default", + "flushCacheUri": "/pools/default/buckets/default/controller/doFlush", + "nodes": [ + { + "clusterMembership": "inactiveAdded", + "status": "unhealthy", + "hostname": "127.0.0.1", + "version": "unknown", + "os": "unknown", + "ports": { + "proxy": 11213, + "direct": 11212 + }, + "uptime": "0", + "memoryTotal": 0, + "memoryFree": 0, + "mcdMemoryReserved": 64, + "mcdMemoryAllocated": 0 + } + ], + "stats": { + "uri": "/pools/default/buckets/default/stats" + }, + "vBucketServerMap": { + "hashAlgorithm": "CRC", + "numReplicas": 2, + "serverList": [ + "server1:11211", + "server2:11210", + "server3:11211" + ], + "vBucketMap": [ + [ 0, 1, 2 ], + [ 1, 2, 0 ], + [ 2, 1, -1 ], + [ 1, 2, 0 ] + ] + }, + "basicStats": { + "cacheSize": 64, + "opsPerSec": 0.0, + "evictionsPerSec": 0.0, + "cachePercentUsed": 0.0 + } +} diff --git a/tests/config/testapp-config-user-password1 b/tests/config/testapp-config-user-password1 new file mode 100644 index 0000000..99cd5f9 --- /dev/null +++ b/tests/config/testapp-config-user-password1 @@ -0,0 +1,17 @@ +{ + "hashAlgorithm": "CRC", + "numReplicas": 2, + "serverList": [ + "server1:11211", + "server2:11210", + "server3:11211" + ], + "name": "theUser", + "saslPassword": "thePassword", + "vBucketMap": [ + [ 0, 1, 2 ], + [ 1, 2, 0 ], + [ 2, 1, -1 ], + [ 1, 2, 0 ] + ] +} diff --git a/tests/config/testapp-config-user-password2 b/tests/config/testapp-config-user-password2 new file mode 100644 index 0000000..49fdb7b --- /dev/null +++ b/tests/config/testapp-config-user-password2 @@ -0,0 +1,17 @@ +{ + "hashAlgorithm": "CRC", + "numReplicas": 2, + "serverList": [ + "server1:11211", + "server2:11210", + "server3:11211" + ], + "name": "theUserIsDifferent", + "saslPassword": "thePasswordIsDifferent", + "vBucketMap": [ + [ 0, 1, 2 ], + [ 1, 2, 0 ], + [ 2, 1, -1 ], + [ 1, 2, 0 ] + ] +} diff --git a/tests/macros.h b/tests/macros.h new file mode 100644 index 0000000..aa81cf8 --- /dev/null +++ b/tests/macros.h @@ -0,0 +1,14 @@ +#ifndef TESTS_MACROS_H +#define TESTS_MACROS_H + +#define assert(expr) \ + do { \ + if (!(expr)) { \ + fprintf(stderr, "%s:%d: assertion failed\n", \ + __FILE__, __LINE__); \ + fflush(stderr); \ + abort(); \ + } \ + } while (0) + +#endif diff --git a/tests/regression.c b/tests/regression.c index 897b028..60608f7 100644 --- a/tests/regression.c +++ b/tests/regression.c @@ -1,5 +1,4 @@ #undef NDEBUG -#include #include #include #include @@ -9,6 +8,8 @@ #include +#include "tests/macros.h" + int main(void) { char *root = getenv("srcdir"); if (root != NULL) { diff --git a/tests/testapp.c b/tests/testapp.c index c54a022..bd821ca 100644 --- a/tests/testapp.c +++ b/tests/testapp.c @@ -1,105 +1,13 @@ /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -#include #include #include #include +#include #include -static const char *config = -"{\n" -" \"hashAlgorithm\": \"CRC\",\n" -" \"numReplicas\": 2,\n" -" \"serverList\": [\"server1:11211\", \"server2:11210\", \"server3:11211\"],\n" -" \"vBucketMap\":\n" -" [\n" -" [0, 1, 2],\n" -" [1, 2, 0],\n" -" [2, 1, -1],\n" -" [1, 2, 0]\n" -" ]\n" -"}"; - -static const char *configFlat = -"{" -" \"hashAlgorithm\": \"CRC\"," -" \"numReplicas\": 2," -" \"serverList\": [\"server1:11211\", \"server2:11210\", \"server3:11211\"]," -" \"vBucketMap\":" -" [" -" [0, 1, 2]," -" [1, 2, 0]," -" [2, 1, -1]," -" [1, 2, 0]" -" ]" -"}"; - -static const char *configInEnvelope = -"{ \"otherKeyThatIsIgnored\": 12345,\n" - "\"vBucketServerMap\": \n" - "{\n" - " \"hashAlgorithm\": \"CRC\",\n" - " \"numReplicas\": 2,\n" - " \"serverList\": [\"server1:11211\", \"server2:11210\", \"server3:11211\"],\n" - " \"vBucketMap\":\n" - " [\n" - " [0, 1, 2],\n" - " [1, 2, 0],\n" - " [2, 1, -1],\n" - " [1, 2, 0]\n" - " ]\n" - "}" -"}"; - -static const char *configInEnvelopeFFT = -"{ \"otherKeyThatIsIgnored\": 12345,\n" - "\"vBucketServerMap\": \n" - "{\n" - " \"hashAlgorithm\": \"CRC\",\n" - " \"numReplicas\": 2,\n" - " \"serverList\": [\"server1:11211\", \"server2:11210\", \"server3:11211\", \"server4:11211\"],\n" - " \"vBucketMap\":\n" - " [\n" - " [0, 1, 2],\n" - " [1, 2, 0],\n" - " [2, 1, -1],\n" - " [1, 2, 0]\n" - " ],\n" - " \"vBucketMapForward\":\n" - " [\n" - " [3, 0, 0],\n" - " [2, 1, 3],\n" - " [1, 2, 2],\n" - " [0, 3, 1]\n" - " ]\n" - "}" -"}"; - - -static const char *configInEnvelope2 = -"{\"name\":\"default\",\"uri\":\"/pools/default/buckets/default\"," - "\"streamingUri\":\"/pools/default/bucketsStreaming/default\"," - "\"flushCacheUri\":\"/pools/default/buckets/default/controller/doFlush\"," - "\"nodes\":[{\"clusterMembership\":\"inactiveAdded\",\"status\":\"unhealthy\"," - "\"hostname\":\"127.0.0.1\",\"version\":\"unknown\",\"os\":\"unknown\"," - "\"ports\":{\"proxy\":11213,\"direct\":11212}," - "\"uptime\":\"0\",\"memoryTotal\":0,\"memoryFree\":0,\"mcdMemoryReserved\":64,\"mcdMemoryAllocated\":0}]," - "\"stats\":{\"uri\":\"/pools/default/buckets/default/stats\"}," - "\"vBucketServerMap\": " - "{" - " \"hashAlgorithm\": \"CRC\"," - " \"numReplicas\": 2," - " \"serverList\": [\"server1:11211\", \"server2:11210\", \"server3:11211\"]," - " \"vBucketMap\":" - " [" - " [0, 1, 2]," - " [1, 2, 0]," - " [2, 1, -1]," - " [1, 2, 0]" - " ]" - "}," - "\"basicStats\":{\"cacheSize\":64,\"opsPerSec\":0.0,\"evictionsPerSec\":0.0,\"cachePercentUsed\":0.0}}"; +#include "tests/macros.h" struct key_st { char *key; @@ -133,13 +41,22 @@ static const struct vb_st vbuckets[] = { 1, { 2, 0 } } }; -static void testConfig(const char *c) { +static char *configPath(const char *fname) { + static char buffer[PATH_MAX]; + char *root = getenv("srcdir"); + + sprintf(buffer, "%s/tests/config/testapp-%s", root, fname); + return buffer; +} + +static void testConfig(const char *fname) { int whoops = 0; const struct key_st *k; int i = 0; - VBUCKET_CONFIG_HANDLE vb = vbucket_config_parse_string(c); + + VBUCKET_CONFIG_HANDLE vb = vbucket_config_parse_file(configPath(fname)); if (vb == NULL) { - fprintf(stderr, "vbucket_config_parse_string error: %s\n", vbucket_get_error()); + fprintf(stderr, "vbucket_config_parse_file error: %s\n", vbucket_get_error()); abort(); } @@ -176,10 +93,10 @@ static void testConfig(const char *c) { } -static void testWrongServer(const char *c) { - VBUCKET_CONFIG_HANDLE vb = vbucket_config_parse_string(c); +static void testWrongServer(const char *fname) { + VBUCKET_CONFIG_HANDLE vb = vbucket_config_parse_file(configPath(fname)); if (vb == NULL) { - fprintf(stderr, "vbucket_config_parse_string error: %s\n", vbucket_get_error()); + fprintf(stderr, "vbucket_config_parse_file error: %s\n", vbucket_get_error()); abort(); } @@ -201,15 +118,14 @@ static void testWrongServer(const char *c) { vbucket_config_destroy(vb); } -static void testWrongServerFFT(const char *c) { - - VBUCKET_CONFIG_HANDLE vb = vbucket_config_parse_string(c); +static void testWrongServerFFT(const char *fname) { + VBUCKET_CONFIG_HANDLE vb = vbucket_config_parse_file(configPath(fname)); int rv = 0; int nvb = 0; int i = 0; if (vb == NULL) { - fprintf(stderr, "vbucket_config_parse_string error: %s\n", vbucket_get_error()); + fprintf(stderr, "vbucket_config_parse_file error: %s\n", vbucket_get_error()); abort(); } @@ -226,49 +142,8 @@ static void testWrongServerFFT(const char *c) { } static void testConfigDiff(void) { - const char *cfg1 = "{\n" - " \"hashAlgorithm\": \"CRC\",\n" - " \"numReplicas\": 2,\n" - " \"serverList\": [\"server1:11211\", \"server2:11210\", \"server3:11211\"],\n" - " \"vBucketMap\":\n" - " [\n" - " [0, 1, 2],\n" - " [1, 2, 0],\n" - " [2, 1, -1],\n" - " [1, 2, 0]\n" - " ]\n" - "}"; - const char *cfg2 = "{\n" - " \"hashAlgorithm\": \"CRC\",\n" - " \"numReplicas\": 2,\n" - " \"serverList\": [\"server1:11211\", \"server2:11210\", \"server4:11211\"],\n" - " \"vBucketMap\":\n" - " [\n" - " [0, 1, 2],\n" - " [1, 2, 0],\n" - " [2, 1, -1],\n" - " [0, 2, 0]\n" - " ]\n" - "}"; - const char *cfg3 = "{\n" - " \"hashAlgorithm\": \"CRC\",\n" - " \"numReplicas\": 1,\n" - " \"serverList\": [\"server1:11211\", \"server2:11210\"],\n" - " \"vBucketMap\":\n" - " [\n" - " [0, 1],\n" - " [1, 0],\n" - " [1, 0],\n" - " [0, 1],\n" - " [0, 1],\n" - " [1, 0],\n" - " [1, 0],\n" - " [0, 1]\n" - " ]\n" - "}"; - - VBUCKET_CONFIG_HANDLE vb1 = vbucket_config_parse_string(cfg1); - VBUCKET_CONFIG_HANDLE vb2 = vbucket_config_parse_string(cfg2); + VBUCKET_CONFIG_HANDLE vb1 = vbucket_config_parse_file(configPath("config-diff1")); + VBUCKET_CONFIG_HANDLE vb2 = vbucket_config_parse_file(configPath("config-diff2")); VBUCKET_CONFIG_DIFF *diff; assert(vb2); @@ -286,7 +161,7 @@ static void testConfigDiff(void) { vbucket_free_diff(diff); vbucket_config_destroy(vb2); - vb2 = vbucket_config_parse_string(cfg3); + vb2 = vbucket_config_parse_file(configPath("config-diff3")); assert(vb2); diff = vbucket_compare(vb1, vb2); @@ -300,8 +175,8 @@ static void testConfigDiff(void) { } static void testConfigDiffSame(void) { - VBUCKET_CONFIG_HANDLE vb1 = vbucket_config_parse_string(config); - VBUCKET_CONFIG_HANDLE vb2 = vbucket_config_parse_string(config); + VBUCKET_CONFIG_HANDLE vb1 = vbucket_config_parse_file(configPath("config")); + VBUCKET_CONFIG_HANDLE vb2 = vbucket_config_parse_file(configPath("config")); VBUCKET_CONFIG_DIFF *diff; assert(vb1); assert(vb2); @@ -319,47 +194,16 @@ static void testConfigDiffSame(void) { } static void testConfigUserPassword(void) { - const char *cfg1 = "{\n" - " \"hashAlgorithm\": \"CRC\",\n" - " \"numReplicas\": 2,\n" - " \"serverList\": [\"server1:11211\", \"server2:11210\", \"server3:11211\"],\n" - " \"name\": \"theUser\",\n" - " \"saslPassword\": \"thePassword\",\n" - " \"vBucketMap\":\n" - " [\n" - " [0, 1, 2],\n" - " [1, 2, 0],\n" - " [2, 1, -1],\n" - " [1, 2, 0]\n" - " ]\n" - "}"; - - const char *cfg2 = "{\n" - " \"hashAlgorithm\": \"CRC\",\n" - " \"numReplicas\": 2,\n" - " \"serverList\": [\"server1:11211\", \"server2:11210\", \"server3:11211\"],\n" - " \"name\": \"theUserIsDifferent\",\n" - " \"saslPassword\": \"thePasswordIsDifferent\",\n" - " \"vBucketMap\":\n" - " [\n" - " [0, 1, 2],\n" - " [1, 2, 0],\n" - " [2, 1, -1],\n" - " [1, 2, 0]\n" - " ]\n" - "}"; - VBUCKET_CONFIG_HANDLE vb1; VBUCKET_CONFIG_HANDLE vb2; VBUCKET_CONFIG_DIFF *diff; - - vb1 = vbucket_config_parse_string(cfg1); + vb1 = vbucket_config_parse_file(configPath("config-user-password1")); assert(vb1); assert(strcmp(vbucket_config_get_user(vb1), "theUser") == 0); assert(strcmp(vbucket_config_get_password(vb1), "thePassword") == 0); - vb2 = vbucket_config_parse_string(cfg2); + vb2 = vbucket_config_parse_file(configPath("config-user-password2")); assert(vb2); assert(strcmp(vbucket_config_get_user(vb2), "theUserIsDifferent") == 0); assert(strcmp(vbucket_config_get_password(vb2), "thePasswordIsDifferent") == 0); @@ -390,64 +234,7 @@ static void testConfigUserPassword(void) { static void testConfigCouchApiBase(void) { - const char *cfg = - "{ " - " \"nodes\": [ " - " { " - " \"hostname\": \"192.168.2.123:9002\", " - " \"couchApiBase\": \"http://192.168.2.123:9502/default\"," - " \"ports\": { " - " \"proxy\": 12005, " - " \"direct\": 12004 " - " } " - " }, " - " { " - " \"hostname\": \"192.168.2.123:9000\", " - " \"couchApiBase\": \"http://192.168.2.123:9500/default\"," - " \"ports\": { " - " \"proxy\": 12001, " - " \"direct\": 12000 " - " } " - " }, " - " { " - " \"hostname\": \"192.168.2.123:9001\", " - " \"couchApiBase\": \"http://192.168.2.123:9501/default\"," - " \"ports\": { " - " \"proxy\": 12003, " - " \"direct\": 12002 " - " } " - " } " - " ], " - " \"vBucketServerMap\": { " - " \"hashAlgorithm\": \"CRC\", " - " \"numReplicas\": 1, " - " \"serverList\": [ " - " \"192.168.2.123:12000\", " - " \"192.168.2.123:12002\", " - " \"192.168.2.123:12004\" " - " ], " - " \"vBucketMap\": [ " - " [ 0, 1 ], " - " [ 0, 1 ], " - " [ 0, 1 ], " - " [ 1, 2 ], " - " [ 1, 2 ], " - " [ 2, 0 ], " - " [ 2, 1 ], " - " [ 2, 1 ], " - " [ 1, 0 ], " - " [ 1, 0 ], " - " [ 1, 0 ], " - " [ 0, 2 ], " - " [ 0, 2 ], " - " [ 0, 2 ], " - " [ 2, 0 ], " - " [ 2, 0 ] " - " ] " - " } " - "} "; - - VBUCKET_CONFIG_HANDLE vb = vbucket_config_parse_string(cfg); + VBUCKET_CONFIG_HANDLE vb = vbucket_config_parse_file(configPath("config-couch-api-base")); assert(vb); assert(strcmp(vbucket_config_get_couch_api_base(vb, 0), "http://192.168.2.123:9500/default") == 0); assert(strcmp(vbucket_config_get_couch_api_base(vb, 1), "http://192.168.2.123:9501/default") == 0); @@ -461,18 +248,16 @@ static void testConfigCouchApiBase(void) } int main(void) { - testConfig(config); - testConfig(configFlat); - testConfig(configInEnvelope); - testConfig(configInEnvelope2); - testConfig(configInEnvelopeFFT); - testWrongServer(config); - testWrongServerFFT(configInEnvelopeFFT); + testConfig("config"); + testConfig("config-flat"); + testConfig("config-in-envelope"); + testConfig("config-in-envelope2"); + testConfig("config-in-envelope-fft"); + testWrongServer("config"); + testWrongServerFFT("config-in-envelope-fft"); testConfigDiff(); testConfigDiffSame(); testConfigUserPassword(); testConfigCouchApiBase(); return 0; } - - diff --git a/tests/testketama.c b/tests/testketama.c index 8155954..28f819f 100644 --- a/tests/testketama.c +++ b/tests/testketama.c @@ -1,7 +1,6 @@ /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ #undef NDEBUG -#include #include #include #include @@ -11,6 +10,7 @@ #include #include "src/hash.h" +#include "tests/macros.h" #define NKEY 10