Skip to content

Commit

Permalink
These two generators create strings without NUL for testing (#4608)
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnHDF authored Jun 27, 2024
1 parent cefadcf commit bbdebee
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 51 deletions.
54 changes: 28 additions & 26 deletions tools/test/h5dump/h5dumpgentest.c
Original file line number Diff line number Diff line change
Expand Up @@ -4064,7 +4064,7 @@ write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to da

/* create 1D attributes with dimension [2], 2 elements */
hsize_t dims[1] = {2};
char buf1[2][3] = {"ab", "de"}; /* string */
char buf1[2][2] = {"ab", "de"}; /* string, NO NUL fixed length */
char buf2[2] = {1, 2}; /* bitfield, opaque */
s_t buf3[2] = {{1, 2}, {3, 4}}; /* compound */
hobj_ref_t buf4[2]; /* reference */
Expand All @@ -4076,8 +4076,8 @@ write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to da

/* create 2D attributes with dimension [3][2], 6 elements */
hsize_t dims2[2] = {3, 2};
char buf12[6][3] = {"ab", "cd", "ef", "gh", "ij", "kl"}; /* string */
char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
char buf12[6][2] = {"ab", "cd", "ef", "gh", "ij", "kl"}; /* string, NO NUL fixed length */
char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
s_t buf32[6] = {{1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}}; /* compound */
hobj_ref_t buf42[3][2]; /* reference */
hvl_t buf52[3][2]; /* vlen */
Expand All @@ -4086,16 +4086,17 @@ write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to da
float buf82[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* float */

/* create 3D attributes with dimension [4][3][2], 24 elements */
hsize_t dims3[3] = {4, 3, 2};
char buf13[24][3] = {"ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", "vw", "xz",
"AB", "CD", "EF", "GH", "IJ", "KL", "MN", "PQ", "RS", "TU", "VW", "XZ"}; /* string */
char buf23[4][3][2]; /* bitfield, opaque */
s_t buf33[4][3][2]; /* compound */
hobj_ref_t buf43[4][3][2]; /* reference */
hvl_t buf53[4][3][2]; /* vlen */
int buf63[24][3]; /* array */
int buf73[4][3][2]; /* integer */
float buf83[4][3][2]; /* float */
hsize_t dims3[3] = {4, 3, 2};
char buf13[24][2] = {
"ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", "vw", "xz", "AB",
"CD", "EF", "GH", "IJ", "KL", "MN", "PQ", "RS", "TU", "VW", "XZ"}; /* string, NO NUL fixed length */
char buf23[4][3][2]; /* bitfield, opaque */
s_t buf33[4][3][2]; /* compound */
hobj_ref_t buf43[4][3][2]; /* reference */
hvl_t buf53[4][3][2]; /* vlen */
int buf63[24][3]; /* array */
int buf73[4][3][2]; /* integer */
float buf83[4][3][2]; /* float */

/*-------------------------------------------------------------------------
* 1D attributes
Expand Down Expand Up @@ -4489,7 +4490,7 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da

/* create 1D attributes with dimension [2], 2 elements */
hsize_t dims[1] = {2};
char buf1[2][3] = {"ab", "de"}; /* string */
char buf1[2][2] = {"ab", "de"}; /* string, NO NUL fixed length */
char buf2[2] = {1, 2}; /* bitfield, opaque */
s_t buf3[2] = {{1, 2}, {3, 4}}; /* compound */
hobj_ref_t buf4[2]; /* reference */
Expand All @@ -4501,8 +4502,8 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da

/* create 2D attributes with dimension [3][2], 6 elements */
hsize_t dims2[2] = {3, 2};
char buf12[6][3] = {"ab", "cd", "ef", "gh", "ij", "kl"}; /* string */
char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
char buf12[6][2] = {"ab", "cd", "ef", "gh", "ij", "kl"}; /* string, NO NUL fixed length */
char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
s_t buf32[6] = {{1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}}; /* compound */
hobj_ref_t buf42[3][2]; /* reference */
hvl_t buf52[3][2]; /* vlen */
Expand All @@ -4511,16 +4512,17 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da
float buf82[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* float */

/* create 3D attributes with dimension [4][3][2], 24 elements */
hsize_t dims3[3] = {4, 3, 2};
char buf13[24][3] = {"ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", "vw", "xz",
"AB", "CD", "EF", "GH", "IJ", "KL", "MN", "PQ", "RS", "TU", "VW", "XZ"}; /* string */
char buf23[4][3][2]; /* bitfield, opaque */
s_t buf33[4][3][2]; /* compound */
hobj_ref_t buf43[4][3][2]; /* reference */
hvl_t buf53[4][3][2]; /* vlen */
int buf63[24][3]; /* array */
int buf73[4][3][2]; /* integer */
float buf83[4][3][2]; /* float */
hsize_t dims3[3] = {4, 3, 2};
char buf13[24][2] = {
"ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", "vw", "xz", "AB",
"CD", "EF", "GH", "IJ", "KL", "MN", "PQ", "RS", "TU", "VW", "XZ"}; /* string, NO NUL fixed length */
char buf23[4][3][2]; /* bitfield, opaque */
s_t buf33[4][3][2]; /* compound */
hobj_ref_t buf43[4][3][2]; /* reference */
hvl_t buf53[4][3][2]; /* vlen */
int buf63[24][3]; /* array */
int buf73[4][3][2]; /* integer */
float buf83[4][3][2]; /* float */

/*-------------------------------------------------------------------------
* 1D
Expand Down
52 changes: 27 additions & 25 deletions tools/test/h5repack/h5repacktst.c
Original file line number Diff line number Diff line change
Expand Up @@ -3974,17 +3974,18 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da
float buf82[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* float */

/* create 3D attributes with dimension [4][3][2], 24 elements */
hsize_t dims3[3] = {4, 3, 2};
hsize_t dims3r[3] = {1, 1, 1};
char buf13[24][3] = {"ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", "vw", "xz",
"AB", "CD", "EF", "GH", "IJ", "KL", "MN", "PQ", "RS", "TU", "VW", "XZ"}; /* string */
char buf23[4][3][2]; /* bitfield, opaque */
s_t buf33[4][3][2]; /* compound */
hobj_ref_t buf43[1][1][1]; /* reference */
hvl_t buf53[4][3][2]; /* vlen */
int buf63[24][3]; /* array */
int buf73[4][3][2]; /* integer */
float buf83[4][3][2]; /* float */
hsize_t dims3[3] = {4, 3, 2};
hsize_t dims3r[3] = {1, 1, 1};
char buf13[24][2] = {
"ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", "vw", "xz", "AB",
"CD", "EF", "GH", "IJ", "KL", "MN", "PQ", "RS", "TU", "VW", "XZ"}; /* string, NO NUL fixed length */
char buf23[4][3][2]; /* bitfield, opaque */
s_t buf33[4][3][2]; /* compound */
hobj_ref_t buf43[1][1][1]; /* reference */
hvl_t buf53[4][3][2]; /* vlen */
int buf63[24][3]; /* array */
int buf73[4][3][2]; /* integer */
float buf83[4][3][2]; /* float */

/*-------------------------------------------------------------------------
* 1D
Expand Down Expand Up @@ -4789,7 +4790,7 @@ write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to da

/* create 1D attributes with dimension [2], 2 elements */
hsize_t dims[1] = {2};
char buf1[2][3] = {"ab", "de"}; /* string */
char buf1[2][2] = {"ab", "de"}; /* string, NO NUL fixed length */
char buf2[2] = {1, 2}; /* bitfield, opaque */
s_t buf3[2] = {{1, 2}, {3, 4}}; /* compound */
hobj_ref_t buf4[2]; /* reference */
Expand All @@ -4802,8 +4803,8 @@ write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to da

/* create 2D attributes with dimension [3][2], 6 elements */
hsize_t dims2[2] = {3, 2};
char buf12[6][3] = {"ab", "cd", "ef", "gh", "ij", "kl"}; /* string */
char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
char buf12[6][2] = {"ab", "cd", "ef", "gh", "ij", "kl"}; /* string, NO NUL fixed length */
char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
s_t buf32[6] = {{1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}}; /* compound */
hobj_ref_t buf42[3][2]; /* reference */
e_t buf452[3][2]; /* enum */
Expand All @@ -4813,17 +4814,18 @@ write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to da
float buf82[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* float */

/* create 3D attributes with dimension [4][3][2], 24 elements */
hsize_t dims3[3] = {4, 3, 2};
char buf13[24][3] = {"ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", "vw", "xz",
"AB", "CD", "EF", "GH", "IJ", "KL", "MN", "PQ", "RS", "TU", "VW", "XZ"}; /* string */
char buf23[4][3][2]; /* bitfield, opaque */
s_t buf33[4][3][2]; /* compound */
hobj_ref_t buf43[4][3][2]; /* reference */
e_t buf453[4][3][2]; /* enum */
hvl_t buf53[4][3][2]; /* vlen */
int buf63[24][3]; /* array */
int buf73[4][3][2]; /* integer */
float buf83[4][3][2]; /* float */
hsize_t dims3[3] = {4, 3, 2};
char buf13[24][2] = {
"ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", "vw", "xz", "AB",
"CD", "EF", "GH", "IJ", "KL", "MN", "PQ", "RS", "TU", "VW", "XZ"}; /* string, NO NUL fixed length */
char buf23[4][3][2]; /* bitfield, opaque */
s_t buf33[4][3][2]; /* compound */
hobj_ref_t buf43[4][3][2]; /* reference */
e_t buf453[4][3][2]; /* enum */
hvl_t buf53[4][3][2]; /* vlen */
int buf63[24][3]; /* array */
int buf73[4][3][2]; /* integer */
float buf83[4][3][2]; /* float */

/*-------------------------------------------------------------------------
* 1D attributes
Expand Down

0 comments on commit bbdebee

Please sign in to comment.