From fda3252166a55b0f6714796ae0d20187b8f0e3e2 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 19 Jan 2005 15:15:26 -0500 Subject: [svn-r9839] Purpose: Bug fix Description: Don't print very long description, check that it's correct internally. Platforms tested: Linux 2.4 (heping) Solaris 2.7 (arabica) --- test/error_test.c | 101 +++++++++++++++++++++++++++++++++++++++----- test/testfiles/error_test_1 | 4 -- 2 files changed, 90 insertions(+), 15 deletions(-) diff --git a/test/error_test.c b/test/error_test.c index 2fd6d21..9fff2a8 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -286,6 +286,95 @@ error_stack(void) return -1; } +/*------------------------------------------------------------------------- + * Function: long_desc_cb + * + * Purpose: Callback function to help test long description handling + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Quincey Koziol + * January 19, 2005 + * + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +long_desc_cb(unsigned n, const H5E_error_t *err_desc, void* client_data) +{ + char *real_desc = (char *)client_data; + + if(err_desc->desc!=NULL && HDstrcmp(err_desc->desc,real_desc)==0) + return(0); + else + return(-1); +} + + +/*------------------------------------------------------------------------- + * Function: test_long_desc + * + * Purpose: Test long error description handling + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Quincey Koziol + * January 19, 2005 + * + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +test_long_desc(void) +{ + char *format="Testing very long description string, %s"; + char *long_desc; + char *full_desc; + size_t u; + const char *test_FUNC="test_long_desc"; + + /* Allocate space for the error description info */ + if((long_desc=HDmalloc(LONG_DESC_SIZE))==NULL) TEST_ERROR; + if((full_desc=HDmalloc(LONG_DESC_SIZE+128))==NULL) TEST_ERROR; + + /* Create the long part of the error description */ + for(u=0; u