TODO: OTP-authenticatd password change tested
[libisds.git] / test / offline / isds_Address_duplicate.c
blob875d15084ca1a7b76dc81515ca1167b603d03de6
1 #include "../test.h"
2 #include "isds.h"
4 static int test_isds_Address_duplicate(struct isds_Address *origin) {
5 struct isds_Address *copy = isds_Address_duplicate(origin);
7 if (!origin) {
8 if (copy)
9 FAIL_TEST("Duplicate of NULL should be NULL");
10 PASS_TEST;
13 if (!copy)
14 FAIL_TEST("isds_Address_duplicate() returned NULL instead of "
15 "pointer to copy");
17 TEST_STRING_DUPLICITY(origin->adCity, copy->adCity);
18 TEST_STRING_DUPLICITY(origin->adStreet, copy->adStreet);
19 TEST_STRING_DUPLICITY(origin->adNumberInStreet, copy->adNumberInStreet);
20 TEST_STRING_DUPLICITY(origin->adNumberInMunicipality,
21 copy->adNumberInMunicipality);
22 TEST_STRING_DUPLICITY(origin->adZipCode, copy->adZipCode);
23 TEST_STRING_DUPLICITY(origin->adState, copy->adState);
25 PASS_TEST;
29 int main(int argc, char **argv) {
31 INIT_TEST("isds_Address_duplicate()");
32 if (isds_init())
33 ABORT_UNIT("isds_init() failed");
35 TEST("NULL", test_isds_Address_duplicate, NULL);
37 struct isds_Address *empty;
38 TEST_CALLOC(empty);
39 TEST("Empty structure", test_isds_Address_duplicate, empty);
41 /* Full structure */
42 struct isds_Address full = {
43 .adCity = "1",
44 .adStreet = "2",
45 .adNumberInStreet = "3",
46 .adNumberInMunicipality = "4",
47 .adZipCode = "5",
48 .adState = "6"
51 TEST("Full structure", test_isds_Address_duplicate, &full);
53 isds_cleanup();
54 SUM_TEST();