index 3b0e956e327404f11c42e96d8391dce60bb08b3b..f9ffabe6d08d39632bb6823cc728af8eb9b6f465 100644 (file)
} attrs[] = {
{ "a", "k1", { SDB_TYPE_STRING, { .string = "v1" } } },
{ "a", "k2", { SDB_TYPE_INTEGER, { .integer = 123 } } },
} attrs[] = {
{ "a", "k1", { SDB_TYPE_STRING, { .string = "v1" } } },
{ "a", "k2", { SDB_TYPE_INTEGER, { .integer = 123 } } },
+ { "b", "k1", { SDB_TYPE_STRING, { .string = "v2" } } },
};
size_t i;
};
size_t i;
/* { "attribute", "attr", "=", &attrname, MATCHER_EQ }, */
{ "attribute", "attr", ">=", &attrname, MATCHER_GE },
{ "attribute", "attr", ">", &attrname, MATCHER_GT },
/* { "attribute", "attr", "=", &attrname, MATCHER_EQ }, */
{ "attribute", "attr", ">=", &attrname, MATCHER_GE },
{ "attribute", "attr", ">", &attrname, MATCHER_GT },
- { "attribute", "attr", "IS", NULL, MATCHER_ISNULL },
- { "attribute", "attr", "IS", &attrname, -1 },
{ "foo", NULL, "=", &attrname, -1 },
{ "foo", "attr", "=", &attrname, -1 },
};
{ "foo", NULL, "=", &attrname, -1 },
{ "foo", "attr", "=", &attrname, -1 },
};
fail_unless(check != NULL,
"sdb_store_matcher_parse_cmp(%s, %s, %s, %s) = %p; "
fail_unless(check != NULL,
"sdb_store_matcher_parse_cmp(%s, %s, %s, %s) = %p; "
- "expected: NULL", golden_data[i].obj_type,
+ "expected: <expr>", golden_data[i].obj_type,
golden_data[i].attr, golden_data[i].op, buf, check);
fail_unless(M(check)->type == golden_data[i].expected,
"sdb_store_matcher_parse_cmp(%s, %s, %s, %s) returned matcher "
golden_data[i].attr, golden_data[i].op, buf, check);
fail_unless(M(check)->type == golden_data[i].expected,
"sdb_store_matcher_parse_cmp(%s, %s, %s, %s) returned matcher "
int expected;
const char *tostring_re;
} golden_data[] = {
int expected;
const char *tostring_re;
} golden_data[] = {
- { "host = 'a'", NULL, 1,
+ { "host = 'a'", NULL, 1,
"OBJ\\[host\\]\\{ NAME\\{ 'a', \\(nil\\) \\} \\}" },
"OBJ\\[host\\]\\{ NAME\\{ 'a', \\(nil\\) \\} \\}" },
- { "host = 'a'", "host = 'x'", 0, /* filter never matches */
+ { "host = 'a'", "host = 'x'", 0, /* filter never matches */
"OBJ\\[host\\]\\{ NAME\\{ 'a', \\(nil\\) \\} \\}" },
{ "host = 'a'",
"OBJ\\[host\\]\\{ NAME\\{ 'a', \\(nil\\) \\} \\}" },
{ "host = 'a'",
- "NOT attribute[x] = ''", 1, /* filter always matches */
+ "NOT attribute['x'] = ''", 1, /* filter always matches */
"OBJ\\[host\\]\\{ NAME\\{ 'a', \\(nil\\) \\} \\}" },
"OBJ\\[host\\]\\{ NAME\\{ 'a', \\(nil\\) \\} \\}" },
- { "host =~ 'a|b'", NULL, 2,
+ { "host =~ 'a|b'", NULL, 2,
"OBJ\\[host\\]\\{ NAME\\{ NULL, "PTR_RE" \\} \\}" },
"OBJ\\[host\\]\\{ NAME\\{ NULL, "PTR_RE" \\} \\}" },
- { "host =~ 'host'", NULL, 0,
+ { "host =~ 'host'", NULL, 0,
"OBJ\\[host\\]\\{ NAME\\{ NULL, "PTR_RE" \\} \\}" },
"OBJ\\[host\\]\\{ NAME\\{ NULL, "PTR_RE" \\} \\}" },
- { "host =~ '.'", NULL, 3,
+ { "host =~ '.'", NULL, 3,
"OBJ\\[host\\]\\{ NAME\\{ NULL, "PTR_RE" \\} \\}" },
"OBJ\\[host\\]\\{ NAME\\{ NULL, "PTR_RE" \\} \\}" },
- { "metric = 'm1'", NULL, 2,
+ { "metric = 'm1'", NULL, 2,
"OBJ\\[metric\\]\\{ NAME\\{ 'm1', \\(nil\\) } \\}" },
"OBJ\\[metric\\]\\{ NAME\\{ 'm1', \\(nil\\) } \\}" },
- { "metric= 'm1'", "host = 'x'", 0, /* filter never matches */
+ { "metric= 'm1'", "host = 'x'", 0, /* filter never matches */
"OBJ\\[metric\\]\\{ NAME\\{ 'm1', \\(nil\\) } \\}" },
{ "metric = 'm1'",
"OBJ\\[metric\\]\\{ NAME\\{ 'm1', \\(nil\\) } \\}" },
{ "metric = 'm1'",
- "NOT attribute[x] = ''", 2, /* filter always matches */
+ "NOT attribute['x'] = ''", 2, /* filter always matches */
"OBJ\\[metric\\]\\{ NAME\\{ 'm1', \\(nil\\) } \\}" },
"OBJ\\[metric\\]\\{ NAME\\{ 'm1', \\(nil\\) } \\}" },
- { "metric =~ 'm'", NULL, 2,
+ { "metric =~ 'm'", NULL, 2,
"OBJ\\[metric\\]\\{ NAME\\{ NULL, "PTR_RE" } \\}" },
"OBJ\\[metric\\]\\{ NAME\\{ NULL, "PTR_RE" } \\}" },
- { "metric !~ 'm'", NULL, 1,
+ { "metric !~ 'm'", NULL, 1,
"\\(NOT, OBJ\\[metric\\]\\{ NAME\\{ NULL, "PTR_RE" } \\}\\)" },
"\\(NOT, OBJ\\[metric\\]\\{ NAME\\{ NULL, "PTR_RE" } \\}\\)" },
- { "metric =~ 'x'", NULL, 0,
+ { "metric =~ 'x'", NULL, 0,
"OBJ\\[metric\\]\\{ NAME\\{ NULL, "PTR_RE" } \\}" },
"OBJ\\[metric\\]\\{ NAME\\{ NULL, "PTR_RE" } \\}" },
- { "service = 's1'", NULL, 2,
+ { "service = 's1'", NULL, 2,
"OBJ\\[service\\]\\{ NAME\\{ 's1', \\(nil\\) } \\}" },
"OBJ\\[service\\]\\{ NAME\\{ 's1', \\(nil\\) } \\}" },
- { "service = 's1'", "host = 'x'", 0, /* filter never matches */
+ { "service = 's1'", "host = 'x'", 0, /* filter never matches */
"OBJ\\[service\\]\\{ NAME\\{ 's1', \\(nil\\) } \\}" },
{ "service = 's1'",
"OBJ\\[service\\]\\{ NAME\\{ 's1', \\(nil\\) } \\}" },
{ "service = 's1'",
- "NOT attribute[x] = ''", 2, /* filter always matches */
+ "NOT attribute['x'] = ''", 2, /* filter always matches */
"OBJ\\[service\\]\\{ NAME\\{ 's1', \\(nil\\) } \\}" },
"OBJ\\[service\\]\\{ NAME\\{ 's1', \\(nil\\) } \\}" },
- { "service =~ 's'", NULL, 2,
+ { "service =~ 's'", NULL, 2,
"OBJ\\[service\\]\\{ NAME\\{ NULL, "PTR_RE" } \\}" },
"OBJ\\[service\\]\\{ NAME\\{ NULL, "PTR_RE" } \\}" },
- { "service !~ 's'", NULL, 1,
+ { "service !~ 's'", NULL, 1,
"\\(NOT, OBJ\\[service\\]\\{ NAME\\{ NULL, "PTR_RE" } \\}\\)" },
"\\(NOT, OBJ\\[service\\]\\{ NAME\\{ NULL, "PTR_RE" } \\}\\)" },
- { "attribute = 'k1'", NULL, 1,
+ { "attribute = 'k1'", NULL, 2,
"OBJ\\[attribute\\]\\{ NAME\\{ 'k1', \\(nil\\) \\} " },
"OBJ\\[attribute\\]\\{ NAME\\{ 'k1', \\(nil\\) \\} " },
- { "attribute = 'k1'", "host = 'x'", 0, /* filter never matches */
+ { "attribute = 'k1'", "host = 'x'", 0, /* filter never matches */
"OBJ\\[attribute\\]\\{ NAME\\{ 'k1', \\(nil\\) \\} " },
{ "attribute = 'k1'",
"OBJ\\[attribute\\]\\{ NAME\\{ 'k1', \\(nil\\) \\} " },
{ "attribute = 'k1'",
- "NOT attribute[x] = ''", 1, /* filter always matches */
+ "NOT attribute['x'] = ''", 2, /* filter always matches */
"OBJ\\[attribute\\]\\{ NAME\\{ 'k1', \\(nil\\) \\} " },
"OBJ\\[attribute\\]\\{ NAME\\{ 'k1', \\(nil\\) \\} " },
- { "attribute = 'x'", NULL, 0,
+ { "attribute = 'x'", NULL, 0,
"OBJ\\[attribute\\]\\{ NAME\\{ 'x', \\(nil\\) \\}" },
"OBJ\\[attribute\\]\\{ NAME\\{ 'x', \\(nil\\) \\}" },
- { "attribute[k1] = 'v1'", NULL, 1,
- "ATTR\\[k1\\]\\{ VALUE\\{ 'v1', \\(nil\\) \\} \\}" },
- { "attribute[k1] IS NULL", NULL, 2,
- "\\(IS NULL, ATTR\\[k1\\]\\)" },
- { "attribute[x1] IS NULL", NULL, 3,
- "\\(IS NULL, ATTR\\[x1\\]\\)" },
- { "attribute[k1] IS NOT NULL", NULL, 1,
- "\\(NOT, \\(IS NULL, ATTR\\[k1\\]\\)\\)" },
- { "attribute[x1] IS NOT NULL", NULL, 0,
- "\\(NOT, \\(IS NULL, ATTR\\[x1\\]\\)\\)" },
- { "attribute[k2] < 123", NULL, 0,
- "ATTR\\[k2\\]\\{ < 123 \\}" },
- { "attribute[k2] <= 123", NULL, 1,
- "ATTR\\[k2\\]\\{ <= 123 \\}" },
- { "attribute[k2] >= 123", NULL, 1,
- "ATTR\\[k2\\]\\{ >= 123 \\}" },
- { "attribute[k2] > 123", NULL, 0,
- "ATTR\\[k2\\]\\{ > 123 \\}" },
- { "attribute[k2] = 123", NULL, 1,
- "ATTR\\[k2\\]\\{ = 123 \\}" },
- { "attribute[k2] != 123", NULL, 2,
- "\\(NOT, ATTR\\[k2\\]\\{ = 123 \\}\\)" },
- { "attribute[k1] != 'v1'", NULL, 2,
- "\\(NOT, ATTR\\[k1\\]\\{ VALUE\\{ 'v1', \\(nil\\) \\} \\}\\)" },
- { "attribute[k1] != 'v2'", NULL, 3,
- "\\(NOT, ATTR\\[k1\\]\\{ VALUE\\{ 'v2', \\(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\\)" },
{ "attribute != 'x' "
{ "attribute != 'x' "
- "AND attribute[y] !~ 'x'", NULL, 3,
+ "AND attribute['y'] !~ 'x'", NULL, 3,
"\\(AND, "
"\\(NOT, OBJ\\[attribute\\]\\{ NAME\\{ 'x', \\(nil\\) \\} \\}\\), "
"\\(AND, "
"\\(NOT, OBJ\\[attribute\\]\\{ NAME\\{ 'x', \\(nil\\) \\} \\}\\), "
- "\\(NOT, ATTR\\[y\\]\\{ VALUE\\{ NULL, "PTR_RE" \\} \\}\\)\\)" },
+ "CMP_MATCHER\\(21\\)" },
};
int check, n;
};
int check, n;