index d0516b306b483cc4fe32c5cd502463014c9eff22..9f24c81e43cf1b054be3e45c1c391cbca6636900 100644 (file)
#define STRING_TYPE "\0\0\0\3"
#define DATETIME_TYPE "\0\0\0\4"
#define BINARY_TYPE "\0\0\0\5"
+#define REGEX_TYPE "\0\0\0\6"
#define NULL_ARRAY "\0\0\1\0"
#define INT_ARRAY "\0\0\1\1"
#define STRING_ARRAY "\0\0\1\3"
#define DATETIME_ARRAY "\0\0\1\4"
#define BINARY_ARRAY "\0\0\1\5"
+#define REGEX_ARRAY "\0\0\1\6"
regex_t dummy_re;
int64_t int_values[] = { 47, 11, 23 };
+ double dec_values[] = { 47.11, .5 };
char *string_values[] = { "foo", "abcd" };
+ sdb_time_t datetime_values[] = { 4711, 1234567890123456789L };
+ struct {
+ size_t length;
+ unsigned char *datum;
+ } binary_values[] = {
+ { 3, (unsigned char *)"\x1\x2\x3" },
+ { 4, (unsigned char *)"\x42\x0\xa\x1b" },
+ };
+ struct {
+ char *raw;
+ regex_t regex;
+ } regex_values[] = {
+ { "dummy regex", dummy_re },
+ };
struct {
sdb_data_t datum;
12, INT_TYPE "\0\0\0\0\0\0\x12\x67",
},
{
- { SDB_TYPE_DECIMAL, { .integer = 4711 } },
- -1, NULL, /* not supported yet */
+ { SDB_TYPE_DECIMAL, { .decimal = 3.141592653e130 } },
+ 12, DECIMAL_TYPE "\x5b\x6\xa9\x40\x66\x1e\x10\x4",
},
{
{ SDB_TYPE_STRING, { .string = "some string" } },
},
{
{ SDB_TYPE_REGEX, { .re = { "dummy", dummy_re } } },
- -1, NULL, /* not supported */
+ 14, REGEX_TYPE "\0\0\0\x6" "dummy\0",
},
{
{ SDB_TYPE_INTEGER | SDB_TYPE_ARRAY, { .array = {
32, INT_ARRAY "\0\0\0\x3" "\0\0\0\0\0\0\0\x2f"
"\0\0\0\0\0\0\0\xb" "\0\0\0\0\0\0\0\x17"
},
+ {
+ { SDB_TYPE_DECIMAL | SDB_TYPE_ARRAY, { .array = {
+ 2, dec_values } } },
+ 24, DECIMAL_ARRAY "\0\0\0\x2" "\x40\x47\x8e\x14\x7a\xe1\x47\xae"
+ "\x3f\xe0\0\0\0\0\0\0"
+ },
{
{ SDB_TYPE_STRING | SDB_TYPE_ARRAY, { .array = {
2, string_values } } },
25, STRING_ARRAY "\0\0\0\x2" "\0\0\0\x4" "foo\0"
"\0\0\0\x5" "abcd\0"
},
+ {
+ { SDB_TYPE_DATETIME | SDB_TYPE_ARRAY, { .array = {
+ 2, datetime_values } } },
+ 24, DATETIME_ARRAY "\0\0\0\x2" "\0\0\0\0\0\0\x12\x67"
+ "\x11\x22\x10\xf4\x7d\xe9\x81\x15"
+ },
+ {
+ { SDB_TYPE_BINARY | SDB_TYPE_ARRAY, { .array = {
+ 2, binary_values } } },
+ 23, BINARY_ARRAY "\0\0\0\x2" "\0\0\0\x3" "\x1\x2\x3"
+ "\0\0\0\4" "\x42\x0\xa\x1b"
+ },
+ {
+ { SDB_TYPE_REGEX | SDB_TYPE_ARRAY, { .array = {
+ 1, regex_values } } },
+ 24, REGEX_ARRAY "\0\0\0\1" "\0\0\0\xc" "dummy regex\0"
+ },
};
size_t i;