4 static int test_string2isds_credit_event_type(const xmlChar
*string
,
5 isds_error error
, isds_credit_event_type
*type
) {
7 isds_credit_event_type new_type
;
9 err
= string2isds_credit_event_type(string
, (type
) ? &new_type
: NULL
);
11 FAIL_TEST("string2isds_credit_event_type() returend wrong exit code: "
12 "expected=%s, got=%s",
13 isds_strerror(error
), isds_strerror(err
));
14 if (err
!= IE_SUCCESS
)
17 if (*type
!= new_type
)
18 FAIL_TEST("string2isds_credit_event_type() returned wrong type: "
19 "expected=%d, got=%d", *type
, new_type
);
25 INIT_TEST("credit_event_type conversion");
27 const xmlChar
*names
[] = {
35 isds_credit_event_type types
[] = {
37 ISDS_CREDIT_DISCHARGED
,
38 ISDS_CREDIT_MESSAGE_SENT
,
39 ISDS_CREDIT_STORAGE_SET
,
45 for (size_t i
= 0; i
< sizeof(types
)/sizeof(types
[0]); i
++)
46 TEST(names
[i
], test_string2isds_credit_event_type
,
47 names
[i
], IE_SUCCESS
, &types
[i
]);
50 TEST("X-Invalid_Type", test_string2isds_credit_event_type
,
51 BAD_CAST
"X-Invalid_Type", IE_ENUM
, &types
[0]);
53 /* Invalid invocation */
54 TEST("NULL string", test_string2isds_credit_event_type
,
55 BAD_CAST NULL
, IE_INVAL
, &types
[0]);
56 TEST("NULL type", test_string2isds_credit_event_type
,
57 names
[0], IE_INVAL
, NULL
);