From fd264f5c9432079d70a664ae80908533f8eb3309 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20P=C3=ADsa=C5=99?= Date: Thu, 31 Oct 2013 19:54:35 +0100 Subject: [PATCH] test: Add isds_Address_free tests --- test/offline/Makefile.am | 3 ++- test/offline/isds_Address_free.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 test/offline/isds_Address_free.c diff --git a/test/offline/Makefile.am b/test/offline/Makefile.am index 0af80a7..39ca1d4 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_BirthInfo_free \ + isds_PersonName_free isds_BirthInfo_free isds_Address_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 \ @@ -136,6 +136,7 @@ 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_Address_free_SOURCES = isds_Address_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_Address_free.c b/test/offline/isds_Address_free.c new file mode 100644 index 0000000..2ecfb92 --- /dev/null +++ b/test/offline/isds_Address_free.c @@ -0,0 +1,40 @@ +#include "../test.h" +#include "isds.h" + +static int test_isds_Address_free( + struct isds_Address **Address) { + isds_Address_free(Address); + if (NULL == Address) PASS_TEST; + + if (NULL != *Address) + FAIL_TEST("isds_Address_free() did not null pointer"); + + PASS_TEST; +} + + +int main(int argc, char **argv) { + + INIT_TEST("isds_Address_free()"); + if (isds_init()) + ABORT_UNIT("isds_init() failed"); + + struct isds_Address *Address = NULL; + TEST("NULL", test_isds_Address_free, NULL); + TEST("*NULL", test_isds_Address_free, &Address); + + TEST_CALLOC(Address); + TEST("Empty structure", test_isds_Address_free, &Address); + + TEST_CALLOC(Address); + TEST_FILL_STRING(Address->adCity); + TEST_FILL_STRING(Address->adStreet); + TEST_FILL_STRING(Address->adNumberInStreet); + TEST_FILL_STRING(Address->adNumberInMunicipality); + TEST_FILL_STRING(Address->adZipCode); + TEST_FILL_STRING(Address->adState); + TEST("Full structure", test_isds_Address_free, &Address); + + isds_cleanup(); + SUM_TEST(); +} -- 2.11.4.GIT