summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9d15e8a)
raw | patch | inline | side by side (parent: 9d15e8a)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 24 Oct 2014 16:08:14 +0000 (18:08 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Fri, 24 Oct 2014 16:08:14 +0000 (18:08 +0200) |
Unknown data-types means that we don't know the type of either one expression
before hand. For example, this is true for attributes given that there is no
schema.
before hand. For example, this is true for attributes given that there is no
schema.
src/core/store_lookup.c | patch | blob | history | |
t/unit/core/store_lookup_test.c | patch | blob | history |
index 3a99f80a2ac0d89e21eddce60ad722734dd2baa1..93fb347852ea969de3ff6bb199454d8560fac511 100644 (file)
--- a/src/core/store_lookup.c
+++ b/src/core/store_lookup.c
status = INT_MAX;
else if (v1.type == v2.type)
status = sdb_data_cmp(&v1, &v2);
+ else if ((e1->data_type >= 0) && (e2->data_type >= 0))
+ status = INT_MAX;
else
status = sdb_data_strcmp(&v1, &v2);
index 4acfc0f4821d67f576037792804f624893af6652..65cbc62d04ed53a4858ab577007800970e50071c 100644 (file)
{ sdb_store_gt_matcher, golden_data[i].expected_gt },
};
+ const char *op_str[] = { "<", "<=", "=", ">=", ">" };
+ assert(SDB_STATIC_ARRAY_LEN(tests) == SDB_STATIC_ARRAY_LEN(op_str));
+
sdb_data_format(&golden_data[i].value,
value_str, sizeof(value_str), SDB_UNQUOTED);
status = sdb_store_matcher_matches(m, host, /* filter */ NULL);
fail_unless(status == tests[j].expected,
- "sdb_store_matcher_matches(<m>, <host>, NULL) = %d; "
- "expected: %d", status, tests[j].expected);
+ "sdb_store_matcher_matches(<attr[%s] %s %s>, "
+ "<host>, NULL) = %d; expected: %d",
+ golden_data[i].attr, op_str[j], value_str,
+ status, tests[j].expected);
sdb_object_deref(SDB_OBJ(m));
}
{ "a", SDB_FIELD_INTERVAL,
{ SDB_TYPE_DATETIME, { .datetime = 1 } }, 1, 1, 0, 0, 0 },
/* type mismatch */
- /* TODO: let matchers only use data_strcmp for attributes
- * everything else has a well-known type
{ "a", SDB_FIELD_LAST_UPDATE,
{ SDB_TYPE_INTEGER, { .integer = 0 } }, 0, 0, 0, 0, 0 },
{ "a", SDB_FIELD_AGE,
{ SDB_TYPE_INTEGER, { .integer = 0 } }, 0, 0, 0, 0, 0 },
{ "a", SDB_FIELD_BACKEND,
{ SDB_TYPE_INTEGER, { .integer = 0 } }, 0, 0, 0, 0, 0 },
- */
/* (64bit) integer value without zero-bytes */
- /*
{ "a", SDB_FIELD_BACKEND,
{ SDB_TYPE_INTEGER, { .integer = 0xffffffffffffffffL } },
0, 0, 0, 0, 0 },
- */
};
int status;