File: isds_DbUserInfo_free.c

package info (click to toggle)
libisds 0.9-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,348 kB
  • ctags: 1,659
  • sloc: ansic: 24,898; sh: 11,772; makefile: 393; xml: 375; sed: 16
file content (60 lines) | stat: -rw-r--r-- 2,049 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "../test.h"
#include "isds.h"

static int test_isds_DbUserInfo_free(
        struct isds_DbUserInfo **DbUserInfo) {
    isds_DbUserInfo_free(DbUserInfo);
    if (!DbUserInfo) PASS_TEST;

    if (*DbUserInfo)
        FAIL_TEST("isds_DbUserInfo_free() did not null pointer");

    PASS_TEST;
}


int main(int argc, char **argv) {

    INIT_TEST("isds_DbUserInfo_free()");
    if (isds_init())
        ABORT_UNIT("isds_init() failed");
    
    struct isds_DbUserInfo *DbUserInfo = NULL;
    TEST("NULL", test_isds_DbUserInfo_free, NULL);
    TEST("*NULL", test_isds_DbUserInfo_free, &DbUserInfo);

    TEST_CALLOC(DbUserInfo);
    TEST("Empty structure", test_isds_DbUserInfo_free, &DbUserInfo);

    /* Full structure */
    TEST_CALLOC(DbUserInfo);
    TEST_FILL_STRING(DbUserInfo->userID);
    TEST_FILL_INT(DbUserInfo->userType)
    TEST_FILL_INT(DbUserInfo->userPrivils);

    TEST_CALLOC(DbUserInfo->personName);       /* Name of the person */
    TEST_FILL_STRING(DbUserInfo->personName->pnFirstName);
    TEST_FILL_STRING(DbUserInfo->personName->pnMiddleName);
    TEST_FILL_STRING(DbUserInfo->personName->pnLastName);
    TEST_FILL_STRING(DbUserInfo->personName->pnLastNameAtBirth);

    TEST_CALLOC(DbUserInfo->address);          /* Post address */
    TEST_FILL_STRING(DbUserInfo->address->adCity);
    TEST_FILL_STRING(DbUserInfo->address->adStreet);
    TEST_FILL_STRING(DbUserInfo->address->adNumberInStreet);
    TEST_FILL_STRING(DbUserInfo->address->adNumberInMunicipality);
    TEST_FILL_STRING(DbUserInfo->address->adZipCode);
    TEST_FILL_STRING(DbUserInfo->address->adState);

    TEST_CALLOC(DbUserInfo->biDate);           /* Date of birth in local time */
    TEST_FILL_STRING(DbUserInfo->ic);
    TEST_FILL_STRING(DbUserInfo->firmName);
    TEST_FILL_STRING(DbUserInfo->caStreet);
    TEST_FILL_STRING(DbUserInfo->caCity);
    TEST_FILL_STRING(DbUserInfo->caZipCode);
    TEST_FILL_STRING(DbUserInfo->caState);
    TEST("Full structure", test_isds_DbUserInfo_free, &DbUserInfo);

    isds_cleanup();
    SUM_TEST();
}