X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Fcore%2Fdata_test.c;h=a16d7fef891a287cec3444d0e5d74872097376f8;hb=f274b5e2002b20b64a84b31791d82e5a195bb771;hp=ebff6845df196a702870b781820f88e1050240db;hpb=633272632f6618c2363a615ea766cec956396118;p=sysdb.git diff --git a/t/core/data_test.c b/t/core/data_test.c index ebff684..a16d7fe 100644 --- a/t/core/data_test.c +++ b/t/core/data_test.c @@ -155,6 +155,17 @@ START_TEST(test_format) "sdb_data_format() used wrong format: %s; expected: %s", string, expected); + datum.data.string = NULL; + sdb_strbuf_clear(buf); + check = sdb_data_format(&datum, buf); + fail_unless(! check, + "sdb_data_format(STRING) = %d; expected: 0", check); + string = sdb_strbuf_string(buf); + expected = "\"NULL\""; + fail_unless(! strcmp(string, expected), + "sdb_data_format() used wrong format: %s; expected: %s", + string, expected); + datum.type = SDB_TYPE_DATETIME; datum.data.datetime = 471147114711471100; sdb_strbuf_clear(buf); @@ -180,6 +191,18 @@ START_TEST(test_format) fail_unless(! strcmp(string, expected), "sdb_data_format() used wrong format: %s; expected: %s", string, expected); + + datum.data.binary.datum = NULL; + datum.data.binary.length = 0; + sdb_strbuf_clear(buf); + check = sdb_data_format(&datum, buf); + fail_unless(! check, + "sdb_data_format(BINARY) = %d; expected: 0", check); + string = sdb_strbuf_string(buf); + expected = "\"\""; + fail_unless(! strcmp(string, expected), + "sdb_data_format() used wrong format: %s; expected: %s", + string, expected); } END_TEST