4 static int test_dbtype2string_must_fail(const isds_DbType type
) {
7 string
= (xmlChar
*) isds_DbType2string(type
);
9 FAIL_TEST("conversion from isds_DbType to string did not fail");
14 static int test_string2dbtype_must_fail(const xmlChar
*string
) {
18 err
= string2isds_DbType((xmlChar
*)string
, &new_type
);
20 FAIL_TEST("conversion from string to isds_DbTyoe did not fail");
25 static int test_dbtype(const isds_DbType type
, const xmlChar
*name
) {
30 string
= (xmlChar
*) isds_DbType2string(type
);
32 FAIL_TEST("conversion from isds_DbType to string failed");
34 if (xmlStrcmp(name
, string
))
35 FAIL_TEST("Wrong to string conversion result");
37 err
= string2isds_DbType(string
, &new_type
);
39 FAIL_TEST("conversion from string to isds_DbTyoe failed");
42 FAIL_TEST("double conversion not idempotent");
47 int main(int argc
, char **argv
) {
48 INIT_TEST("isds_DbType conversion");
50 isds_DbType types
[] = {
65 const xmlChar
*names
[] = {
68 BAD_CAST
"OVM_EXEKUT",
75 BAD_CAST
"PFO_DANPOR",
76 BAD_CAST
"PFO_INSSPR",
80 TEST("DBTYPE_SYSTEM", test_dbtype2string_must_fail
, DBTYPE_SYSTEM
);
82 for (int i
= 0; i
< sizeof(types
)/sizeof(types
[0]); i
++)
83 TEST(isds_DbType2string(types
[i
]), test_dbtype
, types
[i
], names
[i
]);
85 TEST("1234", test_dbtype2string_must_fail
, 1234);
87 TEST("X-Invalid_Type", test_string2dbtype_must_fail
,
88 BAD_CAST
"X-Invalid_Type");