Skip to content

Commit

Permalink
adding tests for reading dataset regions (from region refs)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmaranville committed Dec 1, 2023
1 parent ee82758 commit 4c9bfc1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/hdf5_hl.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export declare const h5wasm: {
Group: typeof Group;
Dataset: typeof Dataset;
Datatype: typeof Datatype;
DatasetRegion: typeof DatasetRegion;
ready: Promise<H5Module>;
ACCESS_MODES: {
readonly r: "H5F_ACC_RDONLY";
Expand Down
1 change: 1 addition & 0 deletions src/hdf5_hl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,7 @@ export const h5wasm = {
Group,
Dataset,
Datatype,
DatasetRegion,
ready,
ACCESS_MODES
}
Expand Down
5 changes: 5 additions & 0 deletions test/create_read_references.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ async function test_refs() {
assert.strictEqual(obj_1.path, `/${DATASET_GROUP}/${DATASET_NAME}`);

const region_refs = refs_group.get(REGION_REF_DATASET_NAME).value;
const [region_0, region_1] = region_refs.map((ref) => read_file.dereference(ref));
assert(region_0 instanceof h5wasm.DatasetRegion);
assert.deepEqual(region_0.value, new Float32Array(REGION_REF_DATA_0.flat()));
assert(region_1 instanceof h5wasm.DatasetRegion);
assert.deepEqual(region_1.value, new Float32Array(REGION_REF_DATA_1.flat()));
// assert.deepEqual(hard_link_dataset.value, DATA);

read_file.close()
Expand Down

0 comments on commit 4c9bfc1

Please sign in to comment.