From 5373524bc80dc32d1a611d8696acf3747828881d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20P=C3=ADsa=C5=99?= Date: Thu, 31 Oct 2013 19:49:18 +0100 Subject: [PATCH] test: Add isds_BirthInfo_free tests --- test/offline/Makefile.am | 3 ++- test/offline/isds_BirthInfo_free.c | 39 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 test/offline/isds_BirthInfo_free.c diff --git a/test/offline/Makefile.am b/test/offline/Makefile.am index 1c9e661..0af80a7 100644 --- a/test/offline/Makefile.am +++ b/test/offline/Makefile.am @@ -22,7 +22,7 @@ TESTS = prepare_environment \ compute_hash context guess_raw_type init_gpgpme isds_init load_raw \ normalize_mime_type utf82locale \ isds_list_free isds_pki_credentials_free isds_hash_free \ - isds_PersonName_free \ + isds_PersonName_free isds_BirthInfo_free \ isds_DbOwnerInfo_free isds_DbUserInfo_free isds_event_free \ isds_envelope_free isds_document_free isds_message_free \ isds_message_copy_free isds_message_status_change_free isds_approval_free \ @@ -135,6 +135,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_PersonName_free_SOURCES = isds_PersonName_free.c $(common) +isds_BirthInfo_free_SOURCES = isds_BirthInfo_free.c $(common) isds_DbOwnerInfo_free_SOURCES = isds_DbOwnerInfo_free.c $(common) isds_DbUserInfo_free_SOURCES = isds_DbUserInfo_free.c $(common) isds_event_free_SOURCES = isds_event_free.c $(common) diff --git a/test/offline/isds_BirthInfo_free.c b/test/offline/isds_BirthInfo_free.c new file mode 100644 index 0000000..2035a51 --- /dev/null +++ b/test/offline/isds_BirthInfo_free.c @@ -0,0 +1,39 @@ +#include "../test.h" +#include "isds.h" + +static int test_isds_BirthInfo_free( + struct isds_BirthInfo **BirthInfo) { + isds_BirthInfo_free(BirthInfo); + if (NULL == BirthInfo) PASS_TEST; + + if (NULL != *BirthInfo) + FAIL_TEST("isds_BirthInfo_free() did not null pointer"); + + PASS_TEST; +} + + +int main(int argc, char **argv) { + + INIT_TEST("isds_BirthInfo_free()"); + if (isds_init()) + ABORT_UNIT("isds_init() failed"); + + struct isds_BirthInfo *BirthInfo = NULL; + TEST("NULL", test_isds_BirthInfo_free, NULL); + TEST("*NULL", test_isds_BirthInfo_free, &BirthInfo); + + TEST_CALLOC(BirthInfo); + TEST("Empty structure", test_isds_BirthInfo_free, &BirthInfo); + + /* Full structure */ + TEST_CALLOC(BirthInfo); + TEST_CALLOC(BirthInfo->biDate); + TEST_FILL_STRING(BirthInfo->biCity); + TEST_FILL_STRING(BirthInfo->biCounty); + TEST_FILL_STRING(BirthInfo->biState); + TEST("Full structure", test_isds_BirthInfo_free, &BirthInfo); + + isds_cleanup(); + SUM_TEST(); +} -- 2.11.4.GIT