diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2014-09-30 22:16:33 (GMT) |
---|---|---|
committer | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2014-09-30 22:16:33 (GMT) |
commit | f2535031952d9c848538043829d43108575cdce3 (patch) | |
tree | e453c00776fc144e3cd90bdab09ccece62b1efb5 /hl/test | |
parent | a9ac64296a8c819d842ffd1dff225c888870c8dc (diff) | |
download | hdf5-f2535031952d9c848538043829d43108575cdce3.zip hdf5-f2535031952d9c848538043829d43108575cdce3.tar.gz hdf5-f2535031952d9c848538043829d43108575cdce3.tar.bz2 |
[svn-r25642] merged changes 25614,25629,25631 into branch.
Diffstat (limited to 'hl/test')
-rw-r--r-- | hl/test/test_lite.c | 38 | ||||
-rw-r--r-- | hl/test/test_table.c | 9 |
2 files changed, 45 insertions, 2 deletions
diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index 576d594..9a15957 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1238,6 +1238,41 @@ static int test_strings(void) } HDfree(dt_str); + /* Length of the character buffer is larger then needed */ + str_len = str_len + 10; + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) + goto out; + + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); + goto out; + } + if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len-1)) { + printf("dt=\n%s\n", dt_str); + HDfree(dt_str); + goto out; + } + + /* Length of the character buffer is smaller then needed */ + str_len = 21; + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) + goto out; + + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); + goto out; + } + /* check the truncated string */ + if(strlen(dt_str) != str_len-1) goto out; + str_len = strlen(dt_str); + if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len)) { + printf("dt=\n%s\n", dt_str); + HDfree(dt_str); + goto out; + } + + HDfree(dt_str); + if(H5Tclose(dtype)<0) goto out; @@ -1245,6 +1280,9 @@ static int test_strings(void) return 0; out: + if(dt_str) + HDfree(dt_str); + H5_FAILED(); return -1; } diff --git a/hl/test/test_table.c b/hl/test/test_table.c index 4b62ac5..4eb5819 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -1195,14 +1195,19 @@ static int test_table(hid_t fid, int do_write) goto out; } - /* read the "Pressure" field */ start = 0; nrecords = NRECORDS; + + /* read an invalid field, should fail */ + if ( H5TBread_fields_name(fid,"table10","DoesNotExist",start,nrecords, + sizeof(float),0,field_sizes_pre,pressure_out) >=0) + goto out; + + /* read the "Pressure" field */ if ( H5TBread_fields_name(fid,"table10","Pressure",start,nrecords, sizeof(float),0,field_sizes_pre,pressure_out)<0) goto out; - /* Compare the extracted table with the initial values */ for( i = 0; i < NRECORDS; i++ ) { |