Update comment at isds_get_box_list_archive()
[libisds.git] / test / offline / isds_PersonName_duplicate.c
blob574fd36de5e50d30ef9cf7ffb47e25ebbdeebe4b
1 #include "../test.h"
2 #include "isds.h"
3 #include <string.h>
5 static int test_isds_PersonName_duplicate(struct isds_PersonName *origin) {
6 struct isds_PersonName *copy = isds_PersonName_duplicate(origin);
7 TEST_DESTRUCTOR((void(*)(void *))isds_PersonName_free, &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_PersonName_duplicate() returned NULL instead of "
17 "pointer to copy");
19 TEST_STRING_DUPLICITY(origin->pnFirstName, copy->pnFirstName);
20 TEST_STRING_DUPLICITY(origin->pnMiddleName, copy->pnMiddleName);
21 TEST_STRING_DUPLICITY(origin->pnLastName, copy->pnLastName);
22 TEST_STRING_DUPLICITY(origin->pnLastNameAtBirth, copy->pnLastNameAtBirth);
24 PASS_TEST;
28 int main(void) {
30 INIT_TEST("isds_PersonName_duplicate()");
31 if (isds_init())
32 ABORT_UNIT("isds_init() failed");
34 TEST("NULL", test_isds_PersonName_duplicate, NULL);
36 struct isds_PersonName empty;
37 memset(&empty, 0, sizeof(empty));
38 TEST("Empty structure", test_isds_PersonName_duplicate, &empty);
40 /* Full structure */
41 struct isds_PersonName full = {
42 .pnFirstName = "1",
43 .pnMiddleName = "2",
44 .pnLastName = "3",
45 .pnLastNameAtBirth = "4"
48 TEST("Full structure", test_isds_PersonName_duplicate, &full);
50 isds_cleanup();
51 SUM_TEST();