diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2002-04-14 01:15:53 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2002-04-14 01:15:53 (GMT) |
commit | 5fa5ec75e02032d19a06ad8ac66a8a5f9b28817a (patch) | |
tree | c8a1a00ee192a021a86219003c58ad4603943cad /test | |
parent | b0d1790d6a238835085ac2e37e1858a5ce3a4106 (diff) | |
download | hdf5-5fa5ec75e02032d19a06ad8ac66a8a5f9b28817a.zip hdf5-5fa5ec75e02032d19a06ad8ac66a8a5f9b28817a.tar.gz hdf5-5fa5ec75e02032d19a06ad8ac66a8a5f9b28817a.tar.bz2 |
[svn-r5183] Purpose:
Feature
Description:
Added test to verify H5_MALLOC_WORKS (malloc zero byte) macro
Platforms tested:
Eirene
Diffstat (limited to 'test')
-rw-r--r-- | test/tconfig.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/test/tconfig.c b/test/tconfig.c index 4882fd0..50e1b7f 100644 --- a/test/tconfig.c +++ b/test/tconfig.c @@ -28,13 +28,14 @@ /* verify C type sizes */ #define vrfy_ctype(ctype, ctype_macro) \ if (sizeof(ctype) != ctype_macro){ \ - print_func("Error verfying %s expected: %d, got: %d\n", \ + print_func("Error verifying %s expected: %d, got: %d\n", \ #ctype_macro, ctype_macro, sizeof(ctype)); \ num_errs++; \ } /* local routine prototypes */ void test_config_ctypes(void); +void test_config_malloc(void); /*------------------------------------------------------------------------- @@ -57,6 +58,7 @@ test_configure(void) /* Output message about test being performed */ MESSAGE(5, ("Testing configure definitions\n")); test_config_ctypes(); + test_config_malloc(); } @@ -181,3 +183,42 @@ test_config_ctypes(void) #endif } + + +/*------------------------------------------------------------------------- + * Function: test_config_malloc + * + * Purpose: test C language malloc function + * + * Return: none (error is fed back via global variable num_errs) + * + * Programmer: Albert Cheng + * April 13, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +test_config_malloc(void) +{ + char *pt; + size_t n; + + /* verify H5_MALLOC_WORKS (malloc zero byte) macros */ + pt = malloc(0); + +#ifdef H5_MALLOC_WORKS + if (pt==NULL){ + print_func("Error verifying H5_MALLOC_WORKS: " + "expected non-NULL, got NULL\n"); + num_errs++; + } +#else + if (pt!=NULL){ + print_func("Error verifying H5_MALLOC_WORKS: " + "expected NULL, got non-NULL\n"); + num_errs++; + } +#endif +} |