4 static int test_string2isds_payment_type(const xmlChar
*string
,
5 isds_error error
, isds_payment_type
*type
) {
7 isds_payment_type new_type
= 0;
9 err
= string2isds_payment_type(string
, (type
) ? &new_type
: NULL
);
11 FAIL_TEST("string2isds_payment_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
&& *type
!= new_type
)
18 FAIL_TEST("string2isds_payment_type() returned wrong type: "
19 "expected=%d, got=%d", *type
, new_type
);
25 INIT_TEST("isds_payment_type conversion");
27 const xmlChar
*names
[] = {
36 isds_payment_type types
[] = {
41 PAYMENT_SPONSOR_LIMITED
,
42 PAYMENT_SPONSOR_EXTERNAL
47 for (size_t i
= 0; i
< sizeof(types
)/sizeof(types
[0]); i
++)
48 TEST(names
[i
], test_string2isds_payment_type
,
49 names
[i
], IE_SUCCESS
, &types
[i
]);
52 TEST("X-Invalid_Type", test_string2isds_payment_type
,
53 BAD_CAST
"X-Invalid_Type", IE_ENUM
, &types
[0]);
55 /* Invalid invocation */
56 TEST("NULL string", test_string2isds_payment_type
,
57 BAD_CAST NULL
, IE_INVAL
, &types
[0]);
58 TEST("NULL type", test_string2isds_payment_type
,
59 names
[0], IE_INVAL
, NULL
);