X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fceph_test.c;h=114114068621097b04ebd5992b039fcaf12a91b9;hb=db35efb33e81d0a013e09a8a6ffa362ad5962f7c;hp=ae67125fc881fe1f63c2e34a0317930b03564bb5;hpb=f9a6df05238501ca41931af0d8d51acea716c105;p=collectd.git diff --git a/src/ceph_test.c b/src/ceph_test.c index ae67125f..11411406 100644 --- a/src/ceph_test.c +++ b/src/ceph_test.c @@ -24,8 +24,8 @@ struct case_s { - char *key; - char *value; + const char *key; + const char *value; }; typedef struct case_s case_t; @@ -136,11 +136,11 @@ DEF_TEST(traverse_json) yajl_handle hndl; #if HAVE_YAJL_V2 hndl = yajl_alloc (&callbacks, NULL, &ctx); - CHECK_ZERO (traverse_json ((unsigned char *) json, (uint32_t) strlen (json), hndl)); + CHECK_ZERO (traverse_json ((const unsigned char *) json, (uint32_t) strlen (json), hndl)); CHECK_ZERO (yajl_complete_parse (hndl)); #else hndl = yajl_alloc (&callbacks, NULL, NULL, &ctx); - CHECK_ZERO (traverse_json ((unsigned char *) json, (uint32_t) strlen (json), hndl)); + CHECK_ZERO (traverse_json ((const unsigned char *) json, (uint32_t) strlen (json), hndl)); CHECK_ZERO (yajl_parse_complete (hndl)); #endif @@ -150,8 +150,8 @@ DEF_TEST(traverse_json) DEF_TEST(parse_keys) { struct { - char *str; - char *want; + const char *str; + const char *want; } cases[] = { {"WBThrottle.bytes_dirtied.description.bytes_wb.description.ios_dirtied.description.ios_wb.type", "WBThrottle.bytesDirtied.description.bytesWb.description.iosDirt"}, {"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, @@ -170,11 +170,8 @@ DEF_TEST(parse_keys) { char got[DATA_MAX_NAME_LEN]; - memset (got, 0, sizeof (got)); - CHECK_ZERO (parse_keys (got, sizeof (got), cases[i].str)); - - CHECK_ZERO (strcmp (got, cases[i].want)); + EXPECT_EQ_STR (cases[i].want, got); } return 0;