summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 241a7b9)
raw | patch | inline | side by side (parent: 241a7b9)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 21 Oct 2014 07:50:42 +0000 (09:50 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Tue, 21 Oct 2014 07:50:42 +0000 (09:50 +0200) |
This function was mainly used for debugging and more verbose error messages
upon test failures. Given that we have more fine-grained tests now, keeping
the tostring() methods up-to-date is rather annoying but for little benefit.
Instead, we should have a real pretty-printer or similar at some point.
upon test failures. Given that we have more fine-grained tests now, keeping
the tostring() methods up-to-date is rather annoying but for little benefit.
Instead, we should have a real pretty-printer or similar at some point.
index 750a0b32bbb4e83706f5ac7658e25cf8e48904bf..c6350b3530c4a2518ce0a515da601c1256768700 100644 (file)
--- a/src/core/store-private.h
+++ b/src/core/store-private.h
* matchers
*/
-/* when adding to this, also update 'MATCHER_SYM' below as well as 'matchers'
- * and 'matchers_tostring' in store_lookup.c */
+/* when adding to this, also update 'MATCHER_SYM' below and 'matchers' in
+ * store_lookup.c */
enum {
MATCHER_OR,
MATCHER_AND,
index e112f4cc9fc35c47714d06042cb42b7cd1f6915d..f1baea644a4c2f2b2ee16e18ecc3d531f0e4f723 100644 (file)
--- a/src/core/store_lookup.c
+++ b/src/core/store_lookup.c
}
} /* string_matcher_destroy */
-static char *
-string_tostring(string_matcher_t *m, char *buf, size_t buflen)
-{
- snprintf(buf, buflen, "{ %s%s%s, %p }",
- m->name ? "'" : "", m->name ? m->name : "NULL", m->name ? "'" : "",
- m->name_re);
- return buf;
-} /* string_tostring */
-
/* initializes a name matcher */
static int
name_matcher_init(sdb_object_t *obj, va_list ap)
string_matcher_destroy(&m->name);
} /* name_matcher_destroy */
-static char *
-name_tostring(sdb_store_matcher_t *m, char *buf, size_t buflen)
-{
- char name[buflen + 1];
- assert(m->type == MATCHER_NAME);
- snprintf(buf, buflen, "OBJ[%s]{ NAME%s }",
- SDB_STORE_TYPE_TO_NAME(NAME_M(m)->obj_type),
- string_tostring(&NAME_M(m)->name, name, sizeof(name)));
- return buf;
-} /* name_tostring */
-
static int
attr_matcher_init(sdb_object_t *obj, va_list ap)
{
string_matcher_destroy(&attr->value);
} /* attr_matcher_destroy */
-static char *
-attr_tostring(sdb_store_matcher_t *m, char *buf, size_t buflen)
-{
- char value[buflen + 1];
-
- if (! m) {
- snprintf(buf, buflen, "ATTR{}");
- return buf;
- }
-
- assert(m->type == MATCHER_ATTR);
- snprintf(buf, buflen, "ATTR[%s]{ VALUE%s }", ATTR_M(m)->name,
- string_tostring(&ATTR_M(m)->value, value, sizeof(value)));
- return buf;
-} /* attr_tostring */
-
static int
cond_matcher_init(sdb_object_t *obj, va_list ap)
{
sdb_object_deref(SDB_OBJ(COND_M(obj)->cond));
} /* cond_matcher_destroy */
-static char *
-cond_tostring(sdb_store_matcher_t *m, char *buf, size_t buflen)
-{
- const char *type, *id;
- sdb_data_t value = SDB_DATA_INIT;
- char value_str[buflen];
- sdb_store_expr_t *expr;
-
- if (COND_M(m)->cond->cmp == attr_cmp) {
- type = "ATTR";
- id = ATTR_C(COND_M(m)->cond)->name;
- expr = ATTR_C(COND_M(m)->cond)->expr;
- }
- else if (COND_M(m)->cond->cmp == obj_cmp) {
- type = "OBJ";
- id = SDB_FIELD_TO_NAME(OBJ_C(COND_M(m)->cond)->field);
- expr = OBJ_C(COND_M(m)->cond)->expr;
- }
- else {
- snprintf(buf, buflen, "<unknown>");
- return buf;
- }
-
- if (sdb_store_expr_eval(expr, /* obj */ NULL, &value, /* filter */ NULL))
- snprintf(value_str, sizeof(value_str), "ERR");
- else if (sdb_data_format(&value, value_str, sizeof(value_str),
- SDB_SINGLE_QUOTED) < 0)
- snprintf(value_str, sizeof(value_str), "ERR");
- snprintf(buf, buflen, "%s[%s]{ %s %s }", type, id,
- MATCHER_SYM(m->type), value_str);
- sdb_data_free_datum(&value);
- return buf;
-} /* cond_tostring */
-
static int
op_matcher_init(sdb_object_t *obj, va_list ap)
{
sdb_object_deref(SDB_OBJ(OP_M(obj)->right));
} /* op_matcher_destroy */
-static char *
-op_tostring(sdb_store_matcher_t *m, char *buf, size_t buflen)
-{
- char left[buflen + 1], right[buflen + 1];
-
- if (! m) {
- /* this should not happen */
- snprintf(buf, buflen, "()");
- return buf;
- }
-
- assert((m->type == MATCHER_OR) || (m->type == MATCHER_AND));
- snprintf(buf, buflen, "(%s, %s, %s)",
- m->type == MATCHER_OR ? "OR" : "AND",
- sdb_store_matcher_tostring(OP_M(m)->left, left, sizeof(left)),
- sdb_store_matcher_tostring(OP_M(m)->right, right, sizeof(right)));
- return buf;
-} /* op_tostring */
-
static int
child_matcher_init(sdb_object_t *obj, va_list ap)
{
sdb_object_deref(SDB_OBJ(CHILD_M(obj)->m));
} /* child_matcher_destroy */
-static char *
-child_tostring(sdb_store_matcher_t *m, char *buf, size_t buflen)
-{
- snprintf(buf, buflen, "%s:", MATCHER_SYM(m->type));
- buf[buflen - 1] = '\0';
- sdb_store_matcher_tostring(CHILD_M(m)->m,
- buf + strlen(buf), buflen - strlen(buf));
- return buf;
-} /* child_tostring */
-
static int
cmp_matcher_init(sdb_object_t *obj, va_list ap)
{
sdb_object_deref(SDB_OBJ(CMP_M(obj)->right));
} /* cmp_matcher_destroy */
-static char *
-cmp_tostring(sdb_store_matcher_t *m, char *buf, size_t buflen)
-{
- if (! m) {
- /* this should not happen */
- snprintf(buf, buflen, "()");
- return buf;
- }
-
- /* TODO */
- snprintf(buf, buflen, "CMP_MATCHER(%d)", m->type);
- return buf;
-} /* cmp_tostring */
-
static int
uop_matcher_init(sdb_object_t *obj, va_list ap)
{
sdb_object_deref(SDB_OBJ(UOP_M(obj)->op));
} /* uop_matcher_destroy */
-static char *
-uop_tostring(sdb_store_matcher_t *m, char *buf, size_t buflen)
-{
- char op[buflen + 1];
-
- if (! m) {
- /* this should not happen */
- snprintf(buf, buflen, "()");
- return buf;
- }
-
- assert(m->type == MATCHER_NOT);
- snprintf(buf, buflen, "(NOT, %s)",
- sdb_store_matcher_tostring(UOP_M(m)->op, op, sizeof(op)));
- return buf;
-} /* uop_tostring */
-
static int
isnull_matcher_init(sdb_object_t *obj, va_list ap)
{
ISNULL_M(obj)->expr = NULL;
} /* isnull_matcher_destroy */
-static char *
-isnull_tostring(sdb_store_matcher_t *m, char *buf, size_t buflen)
-{
- /* XXX */
- if (m->type == MATCHER_ISNULL)
- strncpy(buf, "(IS NULL)", buflen);
- else
- strncpy(buf, "(IS NOT NULL)", buflen);
- return buf;
-} /* isnull_tostring */
-
static sdb_type_t name_type = {
/* size = */ sizeof(name_matcher_t),
/* init = */ name_matcher_init,
/* destroy = */ isnull_matcher_destroy,
};
-typedef char *(*matcher_tostring_cb)(sdb_store_matcher_t *, char *, size_t);
-
-/* this array needs to be indexable by the matcher types;
- * -> update the enum in store-private.h when updating this */
-static matcher_tostring_cb
-matchers_tostring[] = {
- op_tostring,
- op_tostring,
- uop_tostring,
- name_tostring,
- attr_tostring,
- child_tostring,
- child_tostring,
- child_tostring,
- cond_tostring,
- cond_tostring,
- cond_tostring,
- cond_tostring,
- cond_tostring,
- cmp_tostring,
- cmp_tostring,
- cmp_tostring,
- cmp_tostring,
- cmp_tostring,
- cmp_tostring,
- cmp_tostring,
- cmp_tostring,
- cmp_tostring,
- isnull_tostring,
- isnull_tostring,
-};
-
/*
* public API
*/
return matchers[m->type](m, obj, filter);
} /* sdb_store_matcher_matches */
-char *
-sdb_store_matcher_tostring(sdb_store_matcher_t *m, char *buf, size_t buflen)
-{
- if (! m)
- return NULL;
-
- if ((m->type < 0)
- || (((size_t)m->type >= SDB_STATIC_ARRAY_LEN(matchers_tostring))))
- return NULL;
- return matchers_tostring[m->type](m, buf, buflen);
-} /* sdb_store_matcher_tostring */
-
int
sdb_store_scan(sdb_store_matcher_t *m, sdb_store_matcher_t *filter,
sdb_store_lookup_cb cb, void *user_data)
index 2e1e558a87fbc11a2c983261b83235b8448c0129..2624194955c3ed9ebee454fec4e83dc017e0c8ec 100644 (file)
--- a/src/include/core/store.h
+++ b/src/include/core/store.h
sdb_store_matcher_matches(sdb_store_matcher_t *m, sdb_store_obj_t *obj,
sdb_store_matcher_t *filter);
-/*
- * sdb_store_matcher_tostring:
- * Format a matcher object as string. This is meant for logging or debugging
- * purposes.
- */
-char *
-sdb_store_matcher_tostring(sdb_store_matcher_t *m, char *buf, size_t buflen);
-
/*
* sdb_store_lookup_cb:
* Lookup callback. It is called for each matching object when looking up data
index f9ffabe6d08d39632bb6823cc728af8eb9b6f465..c5aad2c51f3670cd6f469d7650de349d6504a56a 100644 (file)
for (i = 0; i < SDB_STATIC_ARRAY_LEN(golden_data); ++i) {
sdb_store_matcher_t *m, *n;
- char buf[1024];
int status;
m = sdb_store_name_matcher(golden_data[i].type,
status = sdb_store_matcher_matches(m, obj, /* filter */ NULL);
fail_unless(status == golden_data[i].expected,
- "sdb_store_matcher_matches(%s, <host a>, NULL) = %d; "
- "expected: %d",
- sdb_store_matcher_tostring(m, buf, sizeof(buf)),
- status, golden_data[i].expected);
+ "sdb_store_matcher_matches(%s->%s, <host a>, NULL) = %d; "
+ "expected: %d", SDB_STORE_TYPE_TO_NAME(golden_data[i].type),
+ golden_data[i].name, status, golden_data[i].expected);
n = sdb_store_inv_matcher(m);
fail_unless(n != NULL,
/* now match the inverted set of objects */
status = sdb_store_matcher_matches(n, obj, /* filter */ NULL);
fail_unless(status == !golden_data[i].expected,
- "sdb_store_matcher_matches(%s, <host a>, NULL) = %d; "
- "expected: %d",
- sdb_store_matcher_tostring(n, buf, sizeof(buf)),
- status, !golden_data[i].expected);
+ "sdb_store_matcher_matches(%s->%s, <host a>, NULL) = %d; "
+ "expected: %d", SDB_STORE_TYPE_TO_NAME(golden_data[i].type),
+ golden_data[i].name, status, !golden_data[i].expected);
sdb_object_deref(SDB_OBJ(n));
}
for (i = 0; i < SDB_STATIC_ARRAY_LEN(golden_data); ++i) {
sdb_store_matcher_t *m, *n;
- char buf[1024];
int status;
m = sdb_store_attr_matcher(golden_data[i].attr_name,
status = sdb_store_matcher_matches(m, obj, /* filter */ NULL);
fail_unless(status == golden_data[i].expected,
- "sdb_store_matcher_matches({%s, <host a>, NULL) = %d; "
- "expected: %d",
- sdb_store_matcher_tostring(m, buf, sizeof(buf)),
- status, golden_data[i].expected);
+ "sdb_store_matcher_matches(attribute[%s] = %s, "
+ "<host a>, NULL) = %d; expected: %d", golden_data[i].attr_name,
+ golden_data[i].attr_value, status, golden_data[i].expected);
n = sdb_store_inv_matcher(m);
fail_unless(n != NULL,
/* now match the inverted set of objects */
status = sdb_store_matcher_matches(n, obj, /* filter */ NULL);
fail_unless(status == !golden_data[i].expected,
- "sdb_store_matcher_matches({%s, <host a>, NULL) = %d; "
- "expected: %d",
- sdb_store_matcher_tostring(n, buf, sizeof(buf)),
+ "sdb_store_matcher_matches(attribute[%s] = %s, "
+ "<host a>, NULL) = %d; expected: %d",
+ golden_data[i].attr_name, golden_data[i].attr_value,
status, !golden_data[i].expected);
sdb_object_deref(SDB_OBJ(n));
for (j = 0; j < SDB_STATIC_ARRAY_LEN(tests); ++j) {
sdb_store_matcher_t *m;
- char m_str[1024];
m = tests[j].matcher(c);
fail_unless(m != NULL,
status = sdb_store_matcher_matches(m, obj, /* filter */ NULL);
fail_unless(status == tests[j].expected,
- "sdb_store_matcher_matches(%s, <obj>, NULL) = %d; "
- "expected: %d",
- sdb_store_matcher_tostring(m, m_str, sizeof(m_str)),
- status, tests[j].expected);
+ "sdb_store_matcher_matches(<m>, <obj>, NULL) = %d; "
+ "expected: %d", status, tests[j].expected);
sdb_object_deref(SDB_OBJ(m));
}
for (j = 0; j < SDB_STATIC_ARRAY_LEN(tests); ++j) {
sdb_store_matcher_t *m;
- char m_str[1024];
m = tests[j].matcher(c);
fail_unless(m != NULL,
status = sdb_store_matcher_matches(m, obj, /* filter */ NULL);
fail_unless(status == tests[j].expected,
- "sdb_store_matcher_matches(%s, <host '%s'>, NULL) = %d; "
- "expected: %d",
- sdb_store_matcher_tostring(m, m_str, sizeof(m_str)),
- status, tests[j].expected);
+ "sdb_store_matcher_matches(<m>, <host '%s'>, NULL) = %d; "
+ "expected: %d", status, tests[j].expected);
sdb_object_deref(SDB_OBJ(m));
}
START_TEST(test_scan)
{
-#define PTR_RE "0x[0-9a-f]+"
struct {
const char *query;
const char *filter;
int expected;
- const char *tostring_re;
} golden_data[] = {
- { "host = 'a'", NULL, 1,
- "OBJ\\[host\\]\\{ NAME\\{ 'a', \\(nil\\) \\} \\}" },
- { "host = 'a'", "host = 'x'", 0, /* filter never matches */
- "OBJ\\[host\\]\\{ NAME\\{ 'a', \\(nil\\) \\} \\}" },
+ { "host = 'a'", NULL, 1 },
+ { "host = 'a'", "host = 'x'", 0 }, /* filter never matches */
{ "host = 'a'",
- "NOT attribute['x'] = ''", 1, /* filter always matches */
- "OBJ\\[host\\]\\{ NAME\\{ 'a', \\(nil\\) \\} \\}" },
- { "host =~ 'a|b'", NULL, 2,
- "OBJ\\[host\\]\\{ NAME\\{ NULL, "PTR_RE" \\} \\}" },
- { "host =~ 'host'", NULL, 0,
- "OBJ\\[host\\]\\{ NAME\\{ NULL, "PTR_RE" \\} \\}" },
- { "host =~ '.'", NULL, 3,
- "OBJ\\[host\\]\\{ NAME\\{ NULL, "PTR_RE" \\} \\}" },
- { "metric = 'm1'", NULL, 2,
- "OBJ\\[metric\\]\\{ NAME\\{ 'm1', \\(nil\\) } \\}" },
- { "metric= 'm1'", "host = 'x'", 0, /* filter never matches */
- "OBJ\\[metric\\]\\{ NAME\\{ 'm1', \\(nil\\) } \\}" },
+ "NOT attribute['x'] = ''", 1 }, /* filter always matches */
+ { "host =~ 'a|b'", NULL, 2 },
+ { "host =~ 'host'", NULL, 0 },
+ { "host =~ '.'", NULL, 3 },
+ { "metric = 'm1'", NULL, 2 },
+ { "metric= 'm1'", "host = 'x'", 0 }, /* filter never matches */
{ "metric = 'm1'",
- "NOT attribute['x'] = ''", 2, /* filter always matches */
- "OBJ\\[metric\\]\\{ NAME\\{ 'm1', \\(nil\\) } \\}" },
- { "metric =~ 'm'", NULL, 2,
- "OBJ\\[metric\\]\\{ NAME\\{ NULL, "PTR_RE" } \\}" },
- { "metric !~ 'm'", NULL, 1,
- "\\(NOT, OBJ\\[metric\\]\\{ NAME\\{ NULL, "PTR_RE" } \\}\\)" },
- { "metric =~ 'x'", NULL, 0,
- "OBJ\\[metric\\]\\{ NAME\\{ NULL, "PTR_RE" } \\}" },
- { "service = 's1'", NULL, 2,
- "OBJ\\[service\\]\\{ NAME\\{ 's1', \\(nil\\) } \\}" },
- { "service = 's1'", "host = 'x'", 0, /* filter never matches */
- "OBJ\\[service\\]\\{ NAME\\{ 's1', \\(nil\\) } \\}" },
+ "NOT attribute['x'] = ''", 2 }, /* filter always matches */
+ { "metric =~ 'm'", NULL, 2 },
+ { "metric !~ 'm'", NULL, 1 },
+ { "metric =~ 'x'", NULL, 0 },
+ { "service = 's1'", NULL, 2 },
+ { "service = 's1'", "host = 'x'", 0 }, /* filter never matches */
{ "service = 's1'",
- "NOT attribute['x'] = ''", 2, /* filter always matches */
- "OBJ\\[service\\]\\{ NAME\\{ 's1', \\(nil\\) } \\}" },
- { "service =~ 's'", NULL, 2,
- "OBJ\\[service\\]\\{ NAME\\{ NULL, "PTR_RE" } \\}" },
- { "service !~ 's'", NULL, 1,
- "\\(NOT, OBJ\\[service\\]\\{ NAME\\{ NULL, "PTR_RE" } \\}\\)" },
- { "attribute = 'k1'", NULL, 2,
- "OBJ\\[attribute\\]\\{ NAME\\{ 'k1', \\(nil\\) \\} " },
- { "attribute = 'k1'", "host = 'x'", 0, /* filter never matches */
- "OBJ\\[attribute\\]\\{ NAME\\{ 'k1', \\(nil\\) \\} " },
+ "NOT attribute['x'] = ''", 2 }, /* filter always matches */
+ { "service =~ 's'", NULL, 2 },
+ { "service !~ 's'", NULL, 1 },
+ { "attribute = 'k1'", NULL, 2 },
+ { "attribute = 'k1'", "host = 'x'", 0 }, /* filter never matches */
{ "attribute = 'k1'",
- "NOT attribute['x'] = ''", 2, /* filter always matches */
- "OBJ\\[attribute\\]\\{ NAME\\{ 'k1', \\(nil\\) \\} " },
- { "attribute = 'x'", NULL, 0,
- "OBJ\\[attribute\\]\\{ NAME\\{ 'x', \\(nil\\) \\}" },
- { "attribute['k1'] = 'v1'", NULL, 1,
- "CMP_MATCHER\\(15\\)" },
- { "attribute['k1'] IS NULL", NULL, 1,
- "\\(IS NULL\\)" },
- { "attribute['x1'] IS NULL", NULL, 3,
- "\\(IS NULL\\)" },
- { "attribute['k1'] IS NOT NULL", NULL, 2,
- "\\(IS NOT NULL\\)" },
- { "attribute['x1'] IS NOT NULL", NULL, 0,
- "\\(IS NOT NULL\\)" },
- { "attribute['k2'] < 123", NULL, 0,
- "CMP_MATCHER\\(13\\)" },
- { "attribute['k2'] <= 123", NULL, 1,
- "CMP_MATCHER\\(14\\)" },
- { "attribute['k2'] >= 123", NULL, 1,
- "CMP_MATCHER\\(17\\)" },
- { "attribute['k2'] > 123", NULL, 0,
- "CMP_MATCHER\\(18\\)" },
- { "attribute['k2'] = 123", NULL, 1,
- "CMP_MATCHER\\(15\\)" },
- { "attribute['k2'] != 123", NULL, 0,
- "CMP_MATCHER\\(16\\)" },
- { "attribute['k1'] != 'v1'", NULL, 1,
- "CMP_MATCHER\\(16\\)" },
- { "attribute['k1'] != 'v2'", NULL, 1,
- "CMP_MATCHER\\(16\\)" },
+ "NOT attribute['x'] = ''", 2 }, /* filter always matches */
+ { "attribute = 'x'", NULL, 0 },
+ { "attribute['k1'] = 'v1'", NULL, 1 },
+ { "attribute['k1'] IS NULL", NULL, 1 },
+ { "attribute['x1'] IS NULL", NULL, 3 },
+ { "attribute['k1'] IS NOT NULL", NULL, 2 },
+ { "attribute['x1'] IS NOT NULL", NULL, 0 },
+ { "attribute['k2'] < 123", NULL, 0 },
+ { "attribute['k2'] <= 123", NULL, 1 },
+ { "attribute['k2'] >= 123", NULL, 1 },
+ { "attribute['k2'] > 123", NULL, 0 },
+ { "attribute['k2'] = 123", NULL, 1 },
+ { "attribute['k2'] != 123", NULL, 0 },
+ { "attribute['k1'] != 'v1'", NULL, 1 },
+ { "attribute['k1'] != 'v2'", NULL, 1 },
{ "attribute != 'x' "
- "AND attribute['y'] !~ 'x'", NULL, 3,
- "\\(AND, "
- "\\(NOT, OBJ\\[attribute\\]\\{ NAME\\{ 'x', \\(nil\\) \\} \\}\\), "
- "CMP_MATCHER\\(21\\)" },
+ "AND attribute['y'] !~ 'x'", NULL, 3 },
};
int check, n;
for (i = 0; i < SDB_STATIC_ARRAY_LEN(golden_data); ++i) {
sdb_store_matcher_t *m, *filter = NULL;
- char buf[4096];
m = sdb_fe_parse_matcher(golden_data[i].query, -1);
fail_unless(m != NULL,
"expected: <matcher>", golden_data[i].filter);
}
- fail_unless(sdb_regmatches(golden_data[i].tostring_re,
- sdb_store_matcher_tostring(m, buf, sizeof(buf))) == 0,
- "sdb_fe_parse_matcher(%s, -1) = %s; expected: %s",
- golden_data[i].query,
- sdb_store_matcher_tostring(m, buf, sizeof(buf)),
- golden_data[i].tostring_re);
-
n = 0;
sdb_store_scan(m, filter, scan_cb, &n);
fail_unless(n == golden_data[i].expected,
index 826d938fc4444a5d02a0bde60812dcb83ebc0933..ddf5ff29a1bb62385fc3f7158cc8e8d22a4fbd8c 100644 (file)
--- a/t/unit/core/store_test.c
+++ b/t/unit/core/store_test.c
static void
verify_json_output(sdb_strbuf_t *buf, const char *expected,
- const char *filter_str, int flags)
+ sdb_store_matcher_t *filter, int flags)
{
int pos;
size_t len1, len2;
}
fail_unless(pos == -1,
- "sdb_store_tojson(<buf>, %s, %x) returned unexpected result\n"
+ "sdb_store_tojson(<buf>, %p, %x) returned unexpected result\n"
" got: %s\n %*s\n expected: %s",
- filter_str, flags, sdb_strbuf_string(buf), pos + 1, "^",
+ filter, flags, sdb_strbuf_string(buf), pos + 1, "^",
expected);
} /* verify_json_output */
for (i = 0; i < SDB_STATIC_ARRAY_LEN(golden_data); ++i) {
sdb_store_matcher_t *filter = NULL;
- char filter_str[1024] = "<none>";
int status;
sdb_strbuf_clear(buf);
sdb_object_deref(SDB_OBJ(c));
fail_unless(filter != NULL,
"INTERNAL ERROR: sdb_store_*_matcher() = NULL");
-
- if (sdb_store_matcher_tostring(filter,
- filter_str, sizeof(filter_str)))
- snprintf(filter_str, sizeof(filter_str), "ERR");
}
status = sdb_store_tojson(buf, filter, golden_data[i].flags);
fail_unless(status == 0,
- "sdb_store_tojson(<buf>, %s, %x) = %d; expected: 0",
- filter_str, golden_data[i].flags, status);
+ "sdb_store_tojson(<buf>, %p, %x) = %d; expected: 0",
+ filter, golden_data[i].flags, status);
verify_json_output(buf, golden_data[i].expected,
- filter_str, golden_data[i].flags);
+ filter, golden_data[i].flags);
sdb_object_deref(SDB_OBJ(filter));
}
sdb_strbuf_destroy(buf);