4 static int test_isds_DbUserInfo_duplicate(struct isds_DbUserInfo
*origin
) {
5 struct isds_DbUserInfo
*copy
= isds_DbUserInfo_duplicate(origin
);
9 FAIL_TEST("Duplicate of NULL should be NULL");
14 FAIL_TEST("isds_DbUserInfo_duplicate() returned NULL instead of "
17 TEST_STRING_DUPLICITY(origin
->userID
, copy
->userID
);
18 TEST_INTPTR_DUPLICITY(origin
->userType
, copy
->userType
);
19 TEST_INTPTR_DUPLICITY(origin
->userPrivils
, copy
->userPrivils
);
22 TEST_POINTER_DUPLICITY(origin
->personName
, copy
->personName
);
23 if (origin
->personName
&& copy
->personName
) {
24 TEST_STRING_DUPLICITY(origin
->personName
->pnFirstName
,
25 copy
->personName
->pnFirstName
);
26 TEST_STRING_DUPLICITY(origin
->personName
->pnMiddleName
,
27 copy
->personName
->pnMiddleName
);
28 TEST_STRING_DUPLICITY(origin
->personName
->pnLastName
,
29 copy
->personName
->pnLastName
);
30 TEST_STRING_DUPLICITY(origin
->personName
->pnLastNameAtBirth
,
31 copy
->personName
->pnLastNameAtBirth
);
35 TEST_POINTER_DUPLICITY(origin
->address
, copy
->address
);
36 if (origin
->address
&& copy
->address
) {
37 TEST_STRING_DUPLICITY(origin
->address
->adCity
,
38 copy
->address
->adCity
);
39 TEST_STRING_DUPLICITY(origin
->address
->adStreet
,
40 copy
->address
->adStreet
);
41 TEST_STRING_DUPLICITY(origin
->address
->adNumberInStreet
,
42 copy
->address
->adNumberInStreet
);
43 TEST_STRING_DUPLICITY(origin
->address
->adNumberInMunicipality
,
44 copy
->address
->adNumberInMunicipality
);
45 TEST_STRING_DUPLICITY(origin
->address
->adZipCode
,
46 copy
->address
->adZipCode
);
47 TEST_STRING_DUPLICITY(origin
->address
->adState
,
48 copy
->address
->adState
);
52 TEST_POINTER_DUPLICITY(origin
->biDate
,
54 if(origin
->biDate
&& copy
->biDate
) {
55 if (origin
->biDate
->tm_year
!= copy
->biDate
->tm_year
)
56 FAIL_TEST("biDate differs in tm_year: expected=%d, got=%d",
57 origin
->biDate
->tm_year
, copy
->biDate
->tm_year
);
58 if (origin
->biDate
->tm_mon
!= copy
->biDate
->tm_mon
)
59 FAIL_TEST("biDate differs in tm_mon: expected=%d, got=%d",
60 origin
->biDate
->tm_mon
, copy
->biDate
->tm_mon
);
61 if (origin
->biDate
->tm_mday
!= copy
->biDate
->tm_mday
)
62 FAIL_TEST("biDate differs in tm_mday: expected=%d, got=%d",
63 origin
->biDate
->tm_mday
, copy
->biDate
->tm_mday
);
66 TEST_INTPTR_DUPLICITY(origin
->ic
, copy
->ic
);
67 TEST_INTPTR_DUPLICITY(origin
->firmName
, copy
->firmName
);
68 TEST_INTPTR_DUPLICITY(origin
->caStreet
, copy
->caStreet
);
69 TEST_INTPTR_DUPLICITY(origin
->caCity
, copy
->caCity
);
70 TEST_INTPTR_DUPLICITY(origin
->caZipCode
, copy
->caZipCode
);
71 TEST_INTPTR_DUPLICITY(origin
->caState
, copy
->caState
);
77 int main(int argc
, char **argv
) {
79 INIT_TEST("isds_DbUserInfo_duplicate()");
81 ABORT_UNIT("isds_init() failed");
83 TEST("NULL", test_isds_DbUserInfo_duplicate
, NULL
);
85 struct isds_DbUserInfo
*empty
;
87 TEST("Empty structure", test_isds_DbUserInfo_duplicate
, empty
);
90 isds_UserType UserType
= 2;
91 long int UserPrivils
= 3;
92 struct isds_PersonName PersonName
= {
96 .pnLastNameAtBirth
= "P4"
98 struct isds_Address Address
= {
101 .adNumberInStreet
= "A3",
102 .adNumberInMunicipality
= "A4",
111 struct isds_DbUserInfo full
= {
113 .userType
= &UserType
,
114 .userPrivils
= &UserPrivils
,
115 .personName
= &PersonName
,
125 TEST("Full structure", test_isds_DbUserInfo_duplicate
, &full
);