index 14d2209a933e0e398a620532a419fae0c27e0e19..49f2268a24d0758dc5165934bb5c75d7908a9947 100644 (file)
# include "config.h"
#endif
+#include "core/plugin.h"
#include "core/store.h"
#include "core/store-private.h"
#include "parser/parser.h"
#include "testutils.h"
-#include <assert.h>
-
#include <check.h>
#include <string.h>
size_t i;
+ sdb_store_init();
+
for (i = 0; i < SDB_STATIC_ARRAY_LEN(hosts); ++i) {
- int status = sdb_store_host(hosts[i], 1);
+ int status = sdb_plugin_store_host(hosts[i], 1);
fail_unless(status == 0,
- "sdb_store_host(%s, 1) = %d; expected: 0",
+ "sdb_plugin_store_host(%s, 1) = %d; expected: 0",
hosts[i], status);
}
for (i = 0; i < SDB_STATIC_ARRAY_LEN(metrics); ++i) {
- int status = sdb_store_metric(metrics[i].host,
+ int status = sdb_plugin_store_metric(metrics[i].host,
metrics[i].metric, /* store */ NULL, 1);
fail_unless(status == 0,
- "sdb_store_metric(%s, %s, NULL, 1) = %d; expected: 0",
+ "sdb_plugin_store_metric(%s, %s, NULL, 1) = %d; expected: 0",
metrics[i].host, metrics[i].metric, status);
}
for (i = 0; i < SDB_STATIC_ARRAY_LEN(services); ++i) {
- int status = sdb_store_service(services[i].host,
+ int status = sdb_plugin_store_service(services[i].host,
services[i].service, 1);
fail_unless(status == 0,
- "sdb_store_service(%s, %s, 1) = %d; expected: 0",
+ "sdb_plugin_store_service(%s, %s, 1) = %d; expected: 0",
services[i].host, services[i].service, status);
}
for (i = 0; i < SDB_STATIC_ARRAY_LEN(attrs); ++i) {
- int status = sdb_store_attribute(attrs[i].host,
+ int status = sdb_plugin_store_attribute(attrs[i].host,
attrs[i].name, &attrs[i].value, 1);
fail_unless(status == 0,
- "sdb_store_attribute(%s, %s, <val>, 1) = %d; expected: 0",
+ "sdb_plugin_store_attribute(%s, %s, <val>, 1) = %d; expected: 0",
attrs[i].host, attrs[i].name, status);
}
} /* populate */
};
const char *op_str[] = { "<", "<=", "=", ">=", ">" };
- assert(SDB_STATIC_ARRAY_LEN(tests) == SDB_STATIC_ARRAY_LEN(op_str));
+ ck_assert(SDB_STATIC_ARRAY_LEN(tests) == SDB_STATIC_ARRAY_LEN(op_str));
host = sdb_store_get_host("a");
fail_unless(host != NULL,
};
char *op_str[] = { "<", "<=", "=", ">=", ">" };
- assert(SDB_STATIC_ARRAY_LEN(tests) == SDB_STATIC_ARRAY_LEN(op_str));
+ ck_assert(SDB_STATIC_ARRAY_LEN(tests) == SDB_STATIC_ARRAY_LEN(op_str));
host = sdb_store_get_host(cmp_obj_data[_i].host);
fail_unless(host != NULL,
NULL, 1 },
{ "host.attribute['x1'] IS NULL",
NULL, 3 },
+ /* not a boolean so neither TRUE nor FALSE: */
+ { "attribute['k1'] IS TRUE", NULL, 0 },
+ { "attribute['k1'] IS FALSE", NULL, 0 },
{ "attribute['k1'] = 'v1'", NULL, 1 },
{ "attribute['k1'] = 'v1'",
"name != 'k1'", 0 },
{ "attribute['x1'] !~ 'v'", NULL, 0 },
{ "attribute['k1'] IS NULL", NULL, 1 },
{ "attribute['x1'] IS NULL", NULL, 3 },
+ { "attribute['k1'] IS TRUE", NULL, 0 },
+ { "attribute['x1'] IS TRUE", NULL, 0 },
+ { "attribute['k1'] IS FALSE", NULL, 0 },
+ { "attribute['x1'] IS FALSE", NULL, 0 },
{ "attribute['k1'] IS NOT NULL", NULL, 2 },
{ "attribute['x1'] IS NOT NULL", NULL, 0 },
+ { "attribute['x1'] IS NOT TRUE", NULL, 3 },
{ "attribute['k2'] < 123", NULL, 0 },
{ "attribute['k2'] <= 123", NULL, 1 },
{ "attribute['k2'] >= 123", NULL, 1 },