Update comment at isds_get_box_list_archive()
[libisds.git] / test / offline / isds_Address_duplicate.c
blobe830ae0d6d694c9ee65ce443e636ef9c5ec5a5ef
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_STRING_DUPLICITY(origin->adCity, copy->adCity);
20 TEST_STRING_DUPLICITY(origin->adStreet, copy->adStreet);
21 TEST_STRING_DUPLICITY(origin->adNumberInStreet, copy->adNumberInStreet);
22 TEST_STRING_DUPLICITY(origin->adNumberInMunicipality,
23 copy->adNumberInMunicipality);
24 TEST_STRING_DUPLICITY(origin->adZipCode, copy->adZipCode);
25 TEST_STRING_DUPLICITY(origin->adState, copy->adState);
27 PASS_TEST;
31 int main(void) {
33 INIT_TEST("isds_Address_duplicate()");
34 if (isds_init())
35 ABORT_UNIT("isds_init() failed");
37 TEST("NULL", test_isds_Address_duplicate, NULL);
39 struct isds_Address empty;
40 memset(&empty, 0, sizeof(empty));
41 TEST("Empty structure", test_isds_Address_duplicate, &empty);
43 /* Full structure */
44 struct isds_Address full = {
45 .adCity = "1",
46 .adStreet = "2",
47 .adNumberInStreet = "3",
48 .adNumberInMunicipality = "4",
49 .adZipCode = "5",
50 .adState = "6"
53 TEST("Full structure", test_isds_Address_duplicate, &full);
55 isds_cleanup();
56 SUM_TEST();