Add adCode and adDistrict to isds_Address, add aifoIsds to isds_DbOwnerInfo
[libisds.git] / test / offline / isds_Address_duplicate.c
blob166989317fbb55959c3813203d0f03756841a269
1 #include "../test.h"
2 #include "isds.h"
3 #include <string.h>
5 static int test_isds_Address_duplicate(struct isds_Address *origin) {
6 struct isds_Address *copy = isds_Address_duplicate(origin);
7 TEST_DESTRUCTOR((void(*)(void*))isds_Address_free, (void *)&copy);
9 if (!origin) {
10 if (copy)
11 FAIL_TEST("Duplicate of NULL should be NULL");
12 PASS_TEST;
15 if (!copy)
16 FAIL_TEST("isds_Address_duplicate() returned NULL instead of "
17 "pointer to copy");
19 TEST_INTPTR_DUPLICITY(origin->adCode, copy->adCode);
20 TEST_STRING_DUPLICITY(origin->adCity, copy->adCity);
21 TEST_STRING_DUPLICITY(origin->adDistrict, copy->adDistrict);
22 TEST_STRING_DUPLICITY(origin->adStreet, copy->adStreet);
23 TEST_STRING_DUPLICITY(origin->adNumberInStreet, copy->adNumberInStreet);
24 TEST_STRING_DUPLICITY(origin->adNumberInMunicipality,
25 copy->adNumberInMunicipality);
26 TEST_STRING_DUPLICITY(origin->adZipCode, copy->adZipCode);
27 TEST_STRING_DUPLICITY(origin->adState, copy->adState);
29 PASS_TEST;
33 int main(void) {
35 INIT_TEST("isds_Address_duplicate()");
36 if (isds_init())
37 ABORT_UNIT("isds_init() failed");
39 TEST("NULL", test_isds_Address_duplicate, NULL);
41 struct isds_Address empty;
42 memset(&empty, 0, sizeof(empty));
43 TEST("Empty structure", test_isds_Address_duplicate, &empty);
45 /* Full structure */
46 long int adCode = 1;
47 struct isds_Address full = {
48 .adCode = &adCode,
49 .adCity = "2",
50 .adDistrict = "3",
51 .adStreet = "4",
52 .adNumberInStreet = "5",
53 .adNumberInMunicipality = "6",
54 .adZipCode = "7",
55 .adState = "8"
58 TEST("Full structure", test_isds_Address_duplicate, &full);
60 isds_cleanup();
61 SUM_TEST();