Skip to content

Add missing dcbor tests for Rust parity and fix ExactF64.exactFromU128#142

Merged
leonardocustodio merged 5 commits into
mainfrom
test/dcbor-rust-parity
Jul 1, 2026
Merged

Add missing dcbor tests for Rust parity and fix ExactF64.exactFromU128#142
leonardocustodio merged 5 commits into
mainfrom
test/dcbor-rust-parity

Conversation

@leonardocustodio

Copy link
Copy Markdown
Member
  • walk: port test_walk_array, test_walk_tagged, test_walk_nested_structure, and test_edge_type_labels from src/walk.rs.
  • exact: cover ExactF32/ExactF64 from u128/i128, plus the f64 MIN_POSITIVE/MAX and i64 MAX/MIN-as-f64 and subnormal boundary cases.

The new exact tests surfaced a divergence: ExactF64.exactFromU128 used a non-saturating round-trip and rejected u128::MAX, unlike Rust's saturating 'f as u128' (and unlike the sibling exactFromU64). Add saturateFloatToU128 and switch the method to the saturating round-trip so u128::MAX rounds to 2^128 and maps back, matching the reference.

Audited the TypeScript dcbor tests against bc-dcbor-rust (c76a15a, v0.25.2)
and closed the remaining portable gaps:

- walk: port test_walk_array, test_walk_tagged, test_walk_nested_structure,
  and test_edge_type_labels from src/walk.rs.
- exact: cover ExactF32/ExactF64 from u128/i128, plus the f64 MIN_POSITIVE/MAX
  and i64 MAX/MIN-as-f64 and subnormal boundary cases.

The new exact tests surfaced a divergence: ExactF64.exactFromU128 used a
non-saturating round-trip and rejected u128::MAX, unlike Rust's saturating
'f as u128' (and unlike the sibling exactFromU64). Add saturateFloatToU128 and
switch the method to the saturating round-trip so u128::MAX rounds to 2^128 and
maps back, matching the reference.
- Bump all @bcts/* packages and the root from 1.0.0-beta.4 to 1.0.0-beta.5.
- Add 1.0.0-beta.5 CHANGELOG entries (coordinated bump); dcbor notes the
  ExactF64.exactFromU128 saturating-round-trip fix and the new Rust-parity
  walk/exact tests carried on this branch.
- Update the version badge in README.
- Reformat 22 files that had drifted from Prettier style (union-type line
  wrapping). build, typecheck, lint, and format:check all pass.
The failing format:check was a prettier version drift: the lockfile is
gitignored, so CI resolved prettier per the caret range (>=3.9.1 -> 3.9.4)
while the files had been formatted with an older 3.8.x. 3.9 wraps multi-line
union types differently, so CI re-flagged the 22 files.

- Reformat the 22 affected files with prettier 3.9.4.
- Pin prettier to an exact '3.9.4' (was '^3.9.1') so CI and local always use
  the same formatter and this can't drift again.

format:check, build, typecheck, and lint all pass.
A newer vue-tsc (resolved from the caret range; the lockfile is gitignored, so
CI drifts ahead of local) enforces that @click handlers return void. 62
idiomatic inline assignment handlers in envelope.vue and xid-builder.vue
(e.g. @click="showX = true") were flagged as returning boolean/string.

Wrap each in an arrow block — @click="() => { showX = true }" — so it returns
void. Behavior-preserving: all are plain state assignments, none use $event.
Full typecheck (26/26), lint, and format:check pass.
@leonardocustodio leonardocustodio merged commit 42b7925 into main Jul 1, 2026
9 checks passed
@leonardocustodio leonardocustodio deleted the test/dcbor-rust-parity branch July 1, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant