test: Add tests for isd_get_commercial_credit()
[libisds.git] / test / offline / isds_PersonName_duplicate.c
blobf7944f88bb83875ef959dd38c1e1e1a4d1eb2a70
1 #include "../test.h"
2 #include "isds.h"
4 static int test_isds_PersonName_duplicate(struct isds_PersonName *origin) {
5 struct isds_PersonName *copy = isds_PersonName_duplicate(origin);
7 if (!origin) {
8 if (copy)
9 FAIL_TEST("Duplicate of NULL should be NULL");
10 PASS_TEST;
13 if (!copy)
14 FAIL_TEST("isds_PersonName_duplicate() returned NULL instead of "
15 "pointer to copy");
17 TEST_STRING_DUPLICITY(origin->pnFirstName, copy->pnFirstName);
18 TEST_STRING_DUPLICITY(origin->pnMiddleName, copy->pnMiddleName);
19 TEST_STRING_DUPLICITY(origin->pnLastName, copy->pnLastName);
20 TEST_STRING_DUPLICITY(origin->pnLastNameAtBirth, copy->pnLastNameAtBirth);
22 PASS_TEST;
26 int main(int argc, char **argv) {
28 INIT_TEST("isds_PersonName_duplicate()");
29 if (isds_init())
30 ABORT_UNIT("isds_init() failed");
32 TEST("NULL", test_isds_PersonName_duplicate, NULL);
34 struct isds_PersonName *empty;
35 TEST_CALLOC(empty);
36 TEST("Empty structure", test_isds_PersonName_duplicate, empty);
38 /* Full structure */
39 struct isds_PersonName full = {
40 .pnFirstName = "1",
41 .pnMiddleName = "2",
42 .pnLastName = "3",
43 .pnLastNameAtBirth = "4"
46 TEST("Full structure", test_isds_PersonName_duplicate, &full);
48 isds_cleanup();
49 SUM_TEST();