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");
48 INIT_TEST("isds_DbType conversion");
50 isds_DbType types
[] = {
69 const xmlChar
*names
[] = {
72 BAD_CAST
"OVM_EXEKUT",
82 BAD_CAST
"PFO_DANPOR",
83 BAD_CAST
"PFO_INSSPR",
84 BAD_CAST
"PFO_AUDITOR",
88 TEST("DBTYPE_OVM_MAIN", test_dbtype2string_must_fail
, DBTYPE_OVM_MAIN
);
89 TEST("DBTYPE_SYSTEM", test_dbtype2string_must_fail
, DBTYPE_SYSTEM
);
91 for (size_t i
= 0; i
< sizeof(types
)/sizeof(types
[0]); i
++)
92 TEST(names
[i
], test_dbtype
, types
[i
], names
[i
]);
94 TEST("1234", test_dbtype2string_must_fail
, 1234);
96 TEST("X-Invalid_Type", test_string2dbtype_must_fail
,
97 BAD_CAST
"X-Invalid_Type");