13
bson_append_int32 (e1, "0", 1984);
14
bson_append_string (e1, "1", "hello world", -1);
18
bson_append_string (e2, "0", "bar", -1);
19
ok (bson_append_array (e2, "1", e1),
20
"bson_append_array() works");
25
ok (bson_append_array (b, "0", e2),
26
"bson_append_array() works still");
30
cmp_ok (bson_size (b), "==", 58, "BSON array element size check");
31
ok (memcmp (bson_data (b),
32
"\072\000\000\000\004\060\000\062\000\000\000\002\060\000\004"
33
"\000\000\000\142\141\162\000\004\061\000\037\000\000\000\020"
34
"\060\000\300\007\000\000\002\061\000\014\000\000\000\150\145"
35
"\154\154\157\040\167\157\162\154\144\000\000\000\000",
37
"BSON array element contents check");
42
bson_append_int32 (e1, "0", 1984);
45
ok (bson_append_array (b, "array", e1) == FALSE,
46
"bson_append_array() with an unfinished array should fail");
48
ok (bson_append_array (b, NULL, e1) == FALSE,
49
"bson_append_array() with a NULL name should fail");
50
ok (bson_append_array (b, "foo", NULL) == FALSE,
51
"bson_append_array() with a NULL array should fail");
52
ok (bson_append_array (NULL, "foo", e1) == FALSE,
53
"bson_append_array() with a NULL BSON should fail");
55
cmp_ok (bson_size (b), "==", 5,
56
"BSON object should be empty");
58
ok (bson_append_array (b, "array", e1) == FALSE,
59
"Appending to a finished element should fail");
65
RUN_TEST (10, bson_array);