Skip to content

Add SubsetOf conversion tests for DualVec#78

Merged
gvonness-apolitical merged 1 commit into
mainfrom
test/dualvec-subsetof-coverage
May 20, 2026
Merged

Add SubsetOf conversion tests for DualVec#78
gvonness-apolitical merged 1 commit into
mainfrom
test/dualvec-subsetof-coverage

Conversation

@gvonness-apolitical

Copy link
Copy Markdown
Contributor

Summary

  • Adds direct tests for the five SubsetOf impls for DualVec<F, N> introduced in Implementation of simba traits for DualVec #38 — identity, f64/f32 embedding, and both cross-precision conversions.
  • Exercises to_superset, from_superset_unchecked, is_in_subset (both the accept and the live-tangent reject case for every scalar impl), and from_superset. nalgebra's matrix operations satisfy the ComplexField / RealField bounds without calling these at runtime, so a regression in the conversion logic — e.g. is_in_subset no longer rejecting live tangents — would otherwise pass silently.
  • The cross-precision test uses a non-f32-representable value, so the lossy f64f32 narrowing is genuinely verified (assert_ne! on the round-trip) rather than only asserted in prose.

Test-only change — no user-facing behaviour, so no CHANGELOG entry.

Test plan

  • cargo test — full suite passes (CI feature set); nalgebra_integration has 17 tests incl. 4 new
  • cargo fmt --check clean
  • cargo clippy --all-targets -- -D warnings clean

PR #38 added the simba SubsetOf impls for DualVec<F, N> but left them
untested. nalgebra's matrix operations satisfy the ComplexField /
RealField bounds without exercising is_in_subset / from_superset at
runtime, so a regression in the conversion logic — e.g. is_in_subset
no longer rejecting live tangents — would pass silently.

Cover all five impls (identity, f64/f32 embedding, and both
cross-precision conversions), exercising to_superset,
from_superset_unchecked, is_in_subset (accept and reject cases), and
from_superset. The cross-precision test uses a non-f32-representable
value so the lossy narrowing is genuinely verified.
@gvonness-apolitical gvonness-apolitical merged commit c8c7e35 into main May 20, 2026
6 checks passed
@gvonness-apolitical gvonness-apolitical deleted the test/dualvec-subsetof-coverage branch May 20, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant