summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 96b93d7)
raw | patch | inline | side by side (parent: 96b93d7)
author | Sebastian Harl <sh@tokkee.org> | |
Thu, 20 Feb 2014 20:57:04 +0000 (21:57 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Thu, 20 Feb 2014 20:57:04 +0000 (21:57 +0100) |
src/include/core/data.h | patch | blob | history | |
t/core/data_test.c | patch | blob | history |
index 58e92cde59583dd7b114b163304223ecdb2f5d9c..c7c51b830c3761f91bb0ff55736a26087fb560e1 100644 (file)
--- a/src/include/core/data.h
+++ b/src/include/core/data.h
SDB_TYPE_BINARY,
};
+#define SDB_TYPE_TO_STRING(t) \
+ (((t) == SDB_TYPE_INTEGER) \
+ ? "INTEGER" \
+ : ((t) == SDB_TYPE_DECIMAL) \
+ ? "DECIMAL" \
+ : ((t) == SDB_TYPE_STRING) \
+ ? "STRING" \
+ : ((t) == SDB_TYPE_DATETIME) \
+ ? "DATETIME" \
+ : ((t) == SDB_TYPE_BINARY) \
+ ? "BINARY" \
+ : "UNKNOWN")
+
/*
* sdb_data_t:
* A datum retrieved from an arbitrary data source.
diff --git a/t/core/data_test.c b/t/core/data_test.c
index 954201451b35c88bd9fbe29a4ba3f038edd635df..d6bd01459bc83019a9fee93f51c399933a24a919 100644 (file)
--- a/t/core/data_test.c
+++ b/t/core/data_test.c
check = sdb_data_format(&golden_data[i].datum, buf);
fail_unless(! check,
- "sdb_data_format() = %d; expected: 0", check);
+ "sdb_data_format(type=%s) = %d; expected: 0",
+ SDB_TYPE_TO_STRING(golden_data[i].datum.type), check);
string = sdb_strbuf_string(buf);
fail_unless(! strcmp(string, golden_data[i].expected),
- "sdb_data_format() used wrong format: %s; expected: %s",
+ "sdb_data_format(type=%s) used wrong format: %s; expected: %s",
+ SDB_TYPE_TO_STRING(golden_data[i].datum.type),
string, golden_data[i].expected);
sdb_strbuf_clear(buf);
}