From e6c11cd117dea5a76723d8908ffb79794dd1676a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20P=C3=ADsa=C5=99?= Date: Sun, 1 Aug 2010 11:54:13 +0200 Subject: [PATCH] test: Add isds_DbUserInfo_free --- test/Makefile.am | 3 ++- test/isds_DbUserInfo_free.c | 46 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 test/isds_DbUserInfo_free.c diff --git a/test/Makefile.am b/test/Makefile.am index 9a5f00c..0b7fc60 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -22,7 +22,7 @@ TESTS = b64decode b64encode \ compute_hash context guess_raw_type init_gpgpme isds_init load_raw \ normalize_mime_type \ isds_list_free isds_pki_credentials_free isds_hash_free \ - isds_DbOwnerInfo_free \ + isds_DbOwnerInfo_free isds_DbUserInfo_free \ isds-dbtype isds-filemetatype isds-hash_algorithm isds-usertype \ isds-datestring2tm isds-tm2datestring \ isds-timestring2timeval isds-timeval2timestring \ @@ -84,6 +84,7 @@ isds_list_free_SOURCES = isds_list_free.c $(common) isds_pki_credentials_free_SOURCES = isds_pki_credentials_free.c $(common) isds_hash_free_SOURCES = isds_hash_free.c $(common) isds_DbOwnerInfo_free_SOURCES = isds_DbOwnerInfo_free.c $(common) +isds_DbUserInfo_free_SOURCES = isds_DbUserInfo_free.c $(common) # Access static symbols from isds.c isds_dbtype_SOURCES = isds-dbtype.c $(isds_common) diff --git a/test/isds_DbUserInfo_free.c b/test/isds_DbUserInfo_free.c new file mode 100644 index 0000000..74bc4e6 --- /dev/null +++ b/test/isds_DbUserInfo_free.c @@ -0,0 +1,46 @@ +#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); + + 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_CALLOC(DbUserInfo->address); /* Post address */ + 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(); +} -- 2.11.4.GIT