From 3bfc2ce574d918206b6ba7d2805897efb980717a Mon Sep 17 00:00:00 2001 From: Axel Bocciarelli Date: Thu, 1 Feb 2024 11:47:32 +0100 Subject: [PATCH] Add byte string array and float128 max value to sample HDF5 file --- create_h5_sample.py | 11 +++- .../__snapshots__/h5grove-api.test.ts.snap | 23 +++++++- .../src/__snapshots__/h5wasm-api.test.ts.snap | 58 +++++++++++++------ 3 files changed, 73 insertions(+), 19 deletions(-) diff --git a/create_h5_sample.py b/create_h5_sample.py index f90f16af3..269094b52 100644 --- a/create_h5_sample.py +++ b/create_h5_sample.py @@ -87,7 +87,11 @@ def print_h5t_class(dataset): ) add_scalar(h5, "float128", np.float128(np.finfo(np.float128).smallest_normal)) - add_array(h5, "float128", np.array([[0, 1, 2], [3, 4, 5]], np.float128)) + add_array( + h5, + "float128", + np.array([[0, 1, 2], [3, 4, np.finfo(np.float128).max]], np.float128), + ) # === H5T_TIME === @@ -113,6 +117,11 @@ def print_h5t_class(dataset): # === H5T_OPAQUE === add_scalar(h5, "byte_string", np.void(b"\x00\x11\x22")) + add_array( + h5, + "byte_string", + np.array([np.void(b"\x00"), np.void(b"\x11"), np.void(b"\x22")]), + ) add_scalar(h5, "datetime64", np.void(np.datetime64("2019-09-22T17:38:30"))) add_scalar(h5, "datetime64_not-a-time", np.void(np.datetime64("NaT"))) diff --git a/packages/app/src/providers/h5grove/__snapshots__/h5grove-api.test.ts.snap b/packages/app/src/providers/h5grove/__snapshots__/h5grove-api.test.ts.snap index 649fc37b2..a976d8840 100644 --- a/packages/app/src/providers/h5grove/__snapshots__/h5grove-api.test.ts.snap +++ b/packages/app/src/providers/h5grove/__snapshots__/h5grove-api.test.ts.snap @@ -676,7 +676,7 @@ exports[`test file matches snapshot 1`] = ` 2, 3, 4, - 5, + null, ], }, { @@ -798,6 +798,27 @@ exports[`test file matches snapshot 1`] = ` }, "value": """, }, + { + "name": "byte_string_1D", + "rawType": { + "class": 5, + "dtype": "|V1", + "size": 1, + "tag": "", + }, + "shape": [ + 3, + ], + "type": { + "class": "Opaque", + "tag": "", + }, + "value": [ + "", + "", + """, + ], + }, { "name": "datetime64_scalar", "rawType": { diff --git a/packages/h5wasm/src/__snapshots__/h5wasm-api.test.ts.snap b/packages/h5wasm/src/__snapshots__/h5wasm-api.test.ts.snap index 16a48e77c..41f8c255d 100644 --- a/packages/h5wasm/src/__snapshots__/h5wasm-api.test.ts.snap +++ b/packages/h5wasm/src/__snapshots__/h5wasm-api.test.ts.snap @@ -885,6 +885,30 @@ exports[`test file matches snapshot 1`] = ` 34, ], }, + { + "name": "byte_string_1D", + "rawType": { + "cset": -1, + "littleEndian": false, + "signed": false, + "size": 1, + "total_size": 3, + "type": 5, + "vlen": false, + }, + "shape": [ + 3, + ], + "type": { + "class": "Opaque", + "tag": "", + }, + "value": Uint8Array [ + 0, + 17, + 34, + ], + }, { "name": "datetime64_scalar", "rawType": { @@ -1745,8 +1769,8 @@ exports[`test file matches snapshot 1`] = ` 0, 0, 0, - 80, - 191, + 72, + 203, 18, 0, ], @@ -1761,8 +1785,8 @@ exports[`test file matches snapshot 1`] = ` 0, 0, 0, - 160, - 213, + 152, + 225, 18, 0, ], @@ -1777,8 +1801,8 @@ exports[`test file matches snapshot 1`] = ` 0, 0, 0, - 184, - 213, + 176, + 225, 18, 0, ], @@ -1801,8 +1825,8 @@ exports[`test file matches snapshot 1`] = ` "class": "Reference", }, "value": Uint8Array [ - 214, - 91, + 226, + 92, 0, 0, 0, @@ -2044,8 +2068,8 @@ exports[`test file matches snapshot 1`] = ` 0, 0, 0, - 72, - 160, + 40, + 156, 18, 0, ], @@ -2075,24 +2099,24 @@ exports[`test file matches snapshot 1`] = ` 0, 0, 0, - 184, - 185, + 176, + 197, 18, 0, 2, 0, 0, 0, - 176, - 207, - 14, + 160, + 65, + 17, 0, 3, 0, 0, 0, - 208, - 224, + 248, + 227, 18, 0, ],