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_POINTER_DUPLICITY(origin
->birthInfo
->biDate
,
40 copy
->birthInfo
->biDate
);
41 if(origin
->birthInfo
->biDate
&& copy
->birthInfo
->biDate
) {
42 if (origin
->birthInfo
->biDate
->tm_year
!=
43 copy
->birthInfo
->biDate
->tm_year
)
44 FAIL_TEST("biDate differs in tm_year: expected=%d, got=%d",
45 origin
->birthInfo
->biDate
->tm_year
,
46 copy
->birthInfo
->biDate
->tm_year
);
47 if (origin
->birthInfo
->biDate
->tm_mon
!=
48 copy
->birthInfo
->biDate
->tm_mon
)
49 FAIL_TEST("biDate differs in tm_mon: expected=%d, got=%d",
50 origin
->birthInfo
->biDate
->tm_mon
,
51 copy
->birthInfo
->biDate
->tm_mon
);
52 if (origin
->birthInfo
->biDate
->tm_mday
!=
53 copy
->birthInfo
->biDate
->tm_mday
)
54 FAIL_TEST("biDate differs in tm_mday: expected=%d, got=%d",
55 origin
->birthInfo
->biDate
->tm_mday
,
56 copy
->birthInfo
->biDate
->tm_mday
);
59 TEST_STRING_DUPLICITY(origin
->birthInfo
->biCity
,
60 copy
->birthInfo
->biCity
);
61 TEST_STRING_DUPLICITY(origin
->birthInfo
->biCounty
,
62 copy
->birthInfo
->biCounty
);
63 TEST_STRING_DUPLICITY(origin
->birthInfo
->biState
,
64 copy
->birthInfo
->biState
);
68 TEST_POINTER_DUPLICITY(origin
->address
, copy
->address
);
69 if (origin
->address
&& copy
->address
) {
70 TEST_STRING_DUPLICITY(origin
->address
->adCity
,
71 copy
->address
->adCity
);
72 TEST_STRING_DUPLICITY(origin
->address
->adStreet
,
73 copy
->address
->adStreet
);
74 TEST_STRING_DUPLICITY(origin
->address
->adNumberInStreet
,
75 copy
->address
->adNumberInStreet
);
76 TEST_STRING_DUPLICITY(origin
->address
->adNumberInMunicipality
,
77 copy
->address
->adNumberInMunicipality
);
78 TEST_STRING_DUPLICITY(origin
->address
->adZipCode
,
79 copy
->address
->adZipCode
);
80 TEST_STRING_DUPLICITY(origin
->address
->adState
,
81 copy
->address
->adState
);
84 TEST_STRING_DUPLICITY(origin
->nationality
, copy
->nationality
);
85 TEST_STRING_DUPLICITY(origin
->email
, copy
->email
);
86 TEST_STRING_DUPLICITY(origin
->telNumber
, copy
->telNumber
);
87 TEST_STRING_DUPLICITY(origin
->identifier
, copy
->identifier
);
88 TEST_STRING_DUPLICITY(origin
->registryCode
, copy
->registryCode
);
89 TEST_INTPTR_DUPLICITY(origin
->dbState
, copy
->dbState
);
90 TEST_BOOLEANPTR_DUPLICITY(origin
->dbEffectiveOVM
, copy
->dbEffectiveOVM
);
91 TEST_BOOLEANPTR_DUPLICITY(origin
->dbOpenAddressing
, copy
->dbOpenAddressing
);
97 int main(int argc
, char **argv
) {
99 INIT_TEST("isds_DbOwnerInfo_duplicate()");
101 ABORT_UNIT("isds_init() failed");
103 TEST("NULL", test_isds_DbOwnerInfo_duplicate
, NULL
);
105 struct isds_DbOwnerInfo empty
;
106 memset(&empty
, 0, sizeof(empty
));
107 TEST("Empty structure", test_isds_DbOwnerInfo_duplicate
, &empty
);
110 isds_DbType dbType
= 2;
111 struct isds_PersonName PersonName
= {
113 .pnMiddleName
= "P2",
115 .pnLastNameAtBirth
= "P4"
122 struct isds_BirthInfo BirthInfo
= {
128 struct isds_Address Address
= {
131 .adNumberInStreet
= "A3",
132 .adNumberInMunicipality
= "A4",
136 long int DbState
= 13;
137 _Bool DbEffectiveOVM
= 1;
138 _Bool DbOpenAddressing
= 1;
139 struct isds_DbOwnerInfo full
= {
143 .personName
= &PersonName
,
145 .birthInfo
= &BirthInfo
,
151 .registryCode
= "12",
153 .dbEffectiveOVM
= &DbEffectiveOVM
,
154 .dbOpenAddressing
= &DbOpenAddressing
156 TEST("Full structure", test_isds_DbOwnerInfo_duplicate
, &full
);