# Test fixtures

Tests use committed `.h5` and `.mat` fixtures and need no Python or native HDF5.
Tests compare semantics because timestamps and binary layouts can vary.

## Regenerate

Run from the repository root. The pinned HDF5 1.14.6 environment is:

```sh
python3 -m venv /tmp/moon-hdf5-h5py
/tmp/moon-hdf5-h5py/bin/pip install h5py==3.13.0 numpy==2.5.4 hdf5storage==0.2.2

/tmp/moon-hdf5-h5py/bin/python scripts/generate_datatype_fixtures.py v114
/tmp/moon-hdf5-h5py/bin/python scripts/generate_metadata_fixtures.py
/tmp/moon-hdf5-h5py/bin/python scripts/generate_external_storage_fixture.py
/tmp/moon-hdf5-h5py/bin/python scripts/generate_external_reference_fixture.py
/tmp/moon-hdf5-h5py/bin/python scripts/generate_shared_messages_fixture.py
/tmp/moon-hdf5-h5py/bin/python scripts/generate_reference_fixtures.py
/tmp/moon-hdf5-h5py/bin/python scripts/generate_nested_reference_fixture.py
/tmp/moon-hdf5-h5py/bin/python scripts/generate_v4_reference_fixture.py
/tmp/moon-hdf5-h5py/bin/python scripts/generate_scaleoffset_fixture.py
/tmp/moon-hdf5-h5py/bin/python scripts/generate_nbit_fixtures.py
/tmp/moon-hdf5-h5py/bin/python scripts/generate_vlen_fill_fixture.py
/tmp/moon-hdf5-h5py/bin/python scripts/generate_nested_vlen_fixture.py
/tmp/moon-hdf5-h5py/bin/python scripts/generate_filtered_attribute_fixture.py
/tmp/moon-hdf5-h5py/bin/python scripts/generate_hard_link_fixture.py
/tmp/moon-hdf5-h5py/bin/python scripts/generate_symbol_table_32_fixture.py
/tmp/moon-hdf5-h5py/bin/python scripts/generate_matlab73_fixture.py
/tmp/moon-hdf5-h5py/bin/python scripts/generate_wide_numeric_fixture.py
/tmp/moon-hdf5-h5py/bin/python scripts/generate_virtual_dataset_fixture.py
/tmp/moon-hdf5-h5py/bin/python scripts/generate_size_matrix_fixtures.py
```

The v114 generator refuses other HDF5 versions. A newer HDF5 2.x environment can
regenerate the remaining structural fixtures:

```sh
python3 -m venv /tmp/moon-hdf5-fixtures
/tmp/moon-hdf5-fixtures/bin/pip install h5py==3.16.0 numpy==2.5.4

/tmp/moon-hdf5-fixtures/bin/python scripts/generate_group_fixtures.py
/tmp/moon-hdf5-fixtures/bin/python scripts/generate_fill_fixtures.py
/tmp/moon-hdf5-fixtures/bin/python scripts/generate_metadata_fixtures.py
/tmp/moon-hdf5-fixtures/bin/python scripts/generate_header_fixtures.py
/tmp/moon-hdf5-fixtures/bin/python scripts/generate_contiguous_fixtures.py
/tmp/moon-hdf5-fixtures/bin/python scripts/generate_filter_fixtures.py
/tmp/moon-hdf5-fixtures/bin/python scripts/generate_v4_fixtures.py
/tmp/moon-hdf5-fixtures/bin/python scripts/generate_fixed_array_fixtures.py
/tmp/moon-hdf5-fixtures/bin/python scripts/generate_extensible_array_fixtures.py
/tmp/moon-hdf5-fixtures/bin/python scripts/generate_btree_v2_fixtures.py
/tmp/moon-hdf5-fixtures/bin/python scripts/generate_interop_matrix.py
/tmp/moon-hdf5-fixtures/bin/python scripts/generate_fractal_heap_fixtures.py
/tmp/moon-hdf5-fixtures/bin/python scripts/generate_enum_fixtures.py
/tmp/moon-hdf5-fixtures/bin/python scripts/generate_datatype_fixtures.py
```

The NetCDF-4 producer fixture needs netCDF4 1.7.5/libnetcdf 4.10.1:

```sh
python3 -m venv /tmp/moon-hdf5-netcf
/tmp/moon-hdf5-netcf/bin/pip install netCDF4==1.7.5 numpy==2.5.4
/tmp/moon-hdf5-netcf/bin/python scripts/generate_netcdf4_fixture.py
```

Independent verifiers run with the HDF5 1.14.6 environment:

```sh
/tmp/moon-hdf5-h5py/bin/python scripts/verify_numeric_layouts_fixture.py testdata/numeric_layouts.h5
/tmp/moon-hdf5-h5py/bin/python scripts/verify_scaleoffset_fixture.py testdata/scaleoffset.h5
/tmp/moon-hdf5-h5py/bin/python scripts/verify_nbit_fixture.py testdata/nbit_filters.h5
/tmp/moon-hdf5-h5py/bin/python scripts/verify_vlen_fill_fixture.py testdata/vlen_fills.h5
/tmp/moon-hdf5-h5py/bin/python scripts/verify_external_storage_fixture.py testdata/external_storage.h5
/tmp/moon-hdf5-h5py/bin/python scripts/verify_external_reference_fixture.py testdata/external_references.h5
/tmp/moon-hdf5-h5py/bin/python scripts/verify_shared_messages_fixture.py testdata/shared_messages.h5
/tmp/moon-hdf5-h5py/bin/python scripts/verify_hard_links_fixture.py testdata/hard_links.h5
/tmp/moon-hdf5-h5py/bin/python scripts/verify_symbol_table_edit.py /tmp/symbol_compact.h5 compact
/tmp/moon-hdf5-h5py/bin/python scripts/verify_symbol_table_edit.py /tmp/symbol_dense.h5 dense
/tmp/moon-hdf5-h5py/bin/python scripts/verify_object_create.py /tmp/created.h5
/tmp/moon-hdf5-h5py/bin/python scripts/verify_object_delete.py /tmp/deleted.h5
/tmp/moon-hdf5-h5py/bin/python scripts/verify_matlab73_fixture.py testdata/matlab73_compatible.mat
/tmp/moon-hdf5-h5py/bin/python scripts/verify_netcdf4_fixture.py testdata/netcdf4_1_7_5.h5
/tmp/moon-hdf5-h5py/bin/python scripts/verify_wide_numeric_fixture.py testdata/wide_numeric.h5
/tmp/moon-hdf5-h5py/bin/python scripts/verify_virtual_dataset_fixture.py
/tmp/moon-hdf5-h5py/bin/python scripts/verify_size_matrix_fixtures.py
```

Regeneration is not part of the release gate; `scripts/release_check.sh`
verifies the committed files.

## Fixture map

| Files | Coverage |
| --- | --- |
| `group_storage.h5`, `attribute_storage.h5` | Empty/compact/dense groups and attributes, with and without creation order |
| `fill_v2.h5`, `fill_v3.h5`, `contiguous_fill_v*.h5` | Fill-message versions, unallocated and partially allocated contiguous storage |
| `numeric_layouts.h5` | Integer widths/byte orders, IEEE float16/32/64, nonstandard precision/offset/padding and normalized binary floats |
| `wide_numeric.h5` | 16-byte signed/unsigned integers, bit-offset integers, x87 80-bit and wide implied/explicit-MSB floats, and big-endian variants |
| `nested_vlen.h5` | Vlen strings used as the base of vlen sequences in contiguous and chunked datasets and a root attribute |
| `scaleoffset.h5` | Integer and f32/f64 decimal scale-offset, big-endian values, fill markers, pipeline and full-precision cases |
| `nbit_filters.h5` | N-bit integer/float fields, big-endian and padded layouts, arrays, nested compounds, no-op members and shuffle/deflate combinations |
| `layout_v4.h5` | Compact/contiguous/chunked layouts, filter masks and all common chunk indexes |
| `fixed_array*.h5`, `extensible_array*.h5`, `btree_v2*.h5` | Paged/super-block fixed and extensible arrays; v2 B-tree chunk indexes |
| `fractal_heap_advanced.h5` | Filtered/raw huge objects, indirect blocks and v2 B-tree heap records |
| `filtered_attributes.h5` | Dense attributes whose fractal heap uses the deflate filter |
| `enums_v108.h5`, `enums_v110.h5` | Enum bases, byte orders, name padding and enum attributes |
| `datatypes_v114*.h5`, `datatypes_v200.h5` | HDF5 1.14.6 and 2.0 datatype-message versions, including compound/array/complex |
| `interop_earliest.h5`, `interop_v108.h5`, `interop_v110.h5`, `interop_32.h5` | Cross-version object matrix and 4-/8-byte addresses |
| `references*.h5`, `references_layouts_32.h5`, `references_v4.h5`, `nested_reference_32.h5` | Legacy object/region references, version-4 object/region/attribute references, null/dangling targets, layouts, selection versions and 4-byte compound references |
| `external_references.h5`, `external_reference_target.h5` | Version-4 object, region and attribute references into a registered external HDF5 file, plus a same-file target and null references |
| `virtual_dataset*.h5` | Same-file and registered external mappings, multiple and strided selections, fill gaps, nested virtual datasets, fixed-to-vlen-string conversion, 4-byte addresses and source files |
| `size_22.h5`–`size_88.h5` | All 2/4/8-byte address and length-width combinations with contiguous, chunked and attribute data |
| `shared_messages.h5` | SOHM table/indexes/heaps, reserved indexes, field, fill and filter-pipeline sharing, dense shared records and committed targets |
| `external_storage*.h5`, `external_storage_*.bin` | Multi-file/offset/unaligned raw-data slots and 4-byte-address storage |
| `vlen_fills.h5` | Default/custom variable-length string fills from producer files |
| `hard_links.h5` | Named hard-link aliases and ancestor-cycle traversal |
| `symbol_table.h5`, `symbol_table_32.h5` | Empty/compact/dense symbol-table groups, hard/soft links, nested groups and 8/8 plus mixed 4-byte-address/8-byte-length layouts |
| `netcdf4_1_7_5.h5` | netCDF group, dimension, chunk, filter, UTF-8 and reference-attribute structures |
| `matlab73_compatible.mat` | hdf5storage metadata, numeric/logical/char/struct and empty arrays |
