5 static int test_isds_DbOwnerInfo_duplicate(struct isds_DbOwnerInfo
*origin
) {
6 struct isds_DbOwnerInfo
*copy
= isds_DbOwnerInfo_duplicate(origin
);
7 TEST_DESTRUCTOR((void(*)(void*))isds_DbOwnerInfo_free
, ©
);
11 FAIL_TEST("Duplicate of NULL should be NULL");
16 FAIL_TEST("isds_DbOwnerInfo_duplicate() returned NULL instead of "
19 TEST_STRING_DUPLICITY(origin
->dbID
, copy
->dbID
);
20 TEST_INTPTR_DUPLICITY(origin
->dbType
, copy
->dbType
);
21 TEST_STRING_DUPLICITY(origin
->ic
, copy
->ic
);
24 TEST_POINTER_DUPLICITY(origin
->personName
, copy
->personName
);
25 if (origin
->personName
&& copy
->personName
) {
26 TEST_STRING_DUPLICITY(origin
->personName
->pnFirstName
,
27 copy
->personName
->pnFirstName
);
28 TEST_STRING_DUPLICITY(origin
->personName
->pnMiddleName
,
29 copy
->personName
->pnMiddleName
);
30 TEST_STRING_DUPLICITY(origin
->personName
->pnLastName
,
31 copy
->personName
->pnLastName
);
32 TEST_STRING_DUPLICITY(origin
->personName
->pnLastNameAtBirth
,
33 copy
->personName
->pnLastNameAtBirth
);
37 TEST_POINTER_DUPLICITY(origin
->birthInfo
, copy
->birthInfo
);
38 if(origin
->birthInfo
&& copy
->birthInfo
) {
39 TEST_TMPTR_DUPLICITY(origin
->birthInfo
->biDate
,
40 copy
->birthInfo
->biDate
);
41 TEST_STRING_DUPLICITY(origin
->birthInfo
->biCity
,
42 copy
->birthInfo
->biCity
);
43 TEST_STRING_DUPLICITY(origin
->birthInfo
->biCounty
,
44 copy
->birthInfo
->biCounty
);
45 TEST_STRING_DUPLICITY(origin
->birthInfo
->biState
,
46 copy
->birthInfo
->biState
);
50 TEST_POINTER_DUPLICITY(origin
->address
, copy
->address
);
51 if (origin
->address
&& copy
->address
) {
52 TEST_STRING_DUPLICITY(origin
->address
->adCity
,
53 copy
->address
->adCity
);
54 TEST_STRING_DUPLICITY(origin
->address
->adStreet
,
55 copy
->address
->adStreet
);
56 TEST_STRING_DUPLICITY(origin
->address
->adNumberInStreet
,
57 copy
->address
->adNumberInStreet
);
58 TEST_STRING_DUPLICITY(origin
->address
->adNumberInMunicipality
,
59 copy
->address
->adNumberInMunicipality
);
60 TEST_STRING_DUPLICITY(origin
->address
->adZipCode
,
61 copy
->address
->adZipCode
);
62 TEST_STRING_DUPLICITY(origin
->address
->adState
,
63 copy
->address
->adState
);
66 TEST_STRING_DUPLICITY(origin
->nationality
, copy
->nationality
);
67 TEST_STRING_DUPLICITY(origin
->email
, copy
->email
);
68 TEST_STRING_DUPLICITY(origin
->telNumber
, copy
->telNumber
);
69 TEST_STRING_DUPLICITY(origin
->identifier
, copy
->identifier
);
70 TEST_STRING_DUPLICITY(origin
->registryCode
, copy
->registryCode
);
71 TEST_INTPTR_DUPLICITY(origin
->dbState
, copy
->dbState
);
72 TEST_BOOLEANPTR_DUPLICITY(origin
->dbEffectiveOVM
, copy
->dbEffectiveOVM
);
73 TEST_BOOLEANPTR_DUPLICITY(origin
->dbOpenAddressing
, copy
->dbOpenAddressing
);
81 INIT_TEST("isds_DbOwnerInfo_duplicate()");
83 ABORT_UNIT("isds_init() failed");
85 TEST("NULL", test_isds_DbOwnerInfo_duplicate
, NULL
);
87 struct isds_DbOwnerInfo empty
;
88 memset(&empty
, 0, sizeof(empty
));
89 TEST("Empty structure", test_isds_DbOwnerInfo_duplicate
, &empty
);
92 isds_DbType dbType
= 2;
93 struct isds_PersonName PersonName
= {
97 .pnLastNameAtBirth
= "P4"
104 struct isds_BirthInfo BirthInfo
= {
110 struct isds_Address Address
= {
113 .adNumberInStreet
= "A3",
114 .adNumberInMunicipality
= "A4",
118 long int DbState
= 13;
119 _Bool DbEffectiveOVM
= 1;
120 _Bool DbOpenAddressing
= 1;
121 struct isds_DbOwnerInfo full
= {
125 .personName
= &PersonName
,
127 .birthInfo
= &BirthInfo
,
133 .registryCode
= "12",
135 .dbEffectiveOVM
= &DbEffectiveOVM
,
136 .dbOpenAddressing
= &DbOpenAddressing
138 TEST("Full structure", test_isds_DbOwnerInfo_duplicate
, &full
);