Skip to content

test, add transform fixture pack for coverage #13

@steven-varga

Description

@steven-varga

Summary

Add a tests/ directory with input headers and golden outputs that exercise the AST visitor across every documented transform path. Wire each fixture into CTest. Target: 94% line coverage as measured by the lcov pipeline introduced in PR #11.

Background

The tool today has no automated tests. PR #11 adds the lcov + Codecov v5 plumbing but reports against an empty test surface, which makes the coverage metric meaningless. This issue populates the surface.

Fixtures are derived directly from the cases enumerated in the project README.

Scope

Fixtures

  • tests/fixtures/primitives.hpp — single POD with all C primitive types (README's typecheck::Record).
  • tests/fixtures/typedef.hpp — typedef'd primitives (MyUInt-style).
  • tests/fixtures/nested-ns.hpp — POD inside nested namespace.
  • tests/fixtures/embedded-pod.hpp — POD with embedded POD-array fields.
  • tests/fixtures/array-of-arrays.hpp — 2D POD array field (README's field_05[3][8]).
  • tests/fixtures/ignored-non-pod.hpp — member of type std::string / std::vector; must be skipped.
  • tests/fixtures/unreferenced.hpp — struct never referenced by h5::read|h5::write|h5::create; must be ignored.
  • tests/fixtures/topological.hpp — three POD types referencing each other in mixed declaration order; output must be topologically sorted.

Golden outputs

  • One tests/golden/<name>.hpp.expected per fixture. Committed verbatim; reviewed by hand on first pass.

CMake / CTest

  • tests/CMakeLists.txt adds one CTest per fixture: runs $<TARGET_FILE:h5cpp> on the fixture → diffs output against golden → fails on non-empty diff.
  • Top-level CMakeLists.txt calls enable_testing() and add_subdirectory(tests).
  • CTest must succeed in all 13 matrix cells (Linux/macOS/Windows). Use cmake -E compare_files for portable diff.

Acceptance criteria

  • 8 fixture + golden pairs committed.
  • All 13 CI cells run the new CTest fixtures and pass.
  • Codecov report after merge shows ≥ 94% line coverage on src/. If the first measurement falls short, PR body documents which AST branches remain uncovered and proposes either (a) additional fixtures or (b) an explicit .codecov.yml ignore list for genuinely unreachable defensive paths.

Dependencies

Conventions

  • Branch: cut from staging, named <N>-test-add-transform-fixture-pack.
  • Commits: [#<N>]:svarga:test, <description>.
  • PR: targets staging, title [#<N>]:svarga:test, add transform fixture pack for coverage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions