Skip to content

refactor: migrate public interface tests to tests/ tree - #60

Open
mzf11125 wants to merge 1 commit into
leanEthereum:mainfrom
mzf11125:refactor/migrate-tests
Open

refactor: migrate public interface tests to tests/ tree#60
mzf11125 wants to merge 1 commit into
leanEthereum:mainfrom
mzf11125:refactor/migrate-tests

Conversation

@mzf11125

Copy link
Copy Markdown

Description

Migrate unit tests for public interfaces out of inline #[cfg(test)] modules into a dedicated tests/ directory that mirrors src/, as proposed in #53.

What changed

  • Added tests/array.rs, tests/inc_encoding/target_sum.rs, tests/symmetric/prf/shake_to_field.rs, and tests/symmetric/tweak_hash.rs.
  • Removed the corresponding inline test modules from src/.
  • Registered the nested integration test targets in Cargo.toml via explicit [[test]] entries (Cargo only auto-discovers top-level tests/*.rs).
  • The test-only PoseidonMessageHash445 and PoseidonTweak44 aliases are defined locally in their integration test files, since the originals are #[cfg(test)]-gated in the library.

What stayed inline (and why)

Tests that exercise crate-private helpers or #[cfg(test)]-gated test_templates remain inline: simd_utils (pub(crate) functions and PackedF), message_hash, tweak_hash/poseidon (compute_tree_layer/compute_tree_leaves are private), tweak_hash_tree (commit_open is private), and the signature/generalized_xmss modules.

Tests

  • cargo test passes (87 lib + 24 integration tests).
  • cargo fmt -- --check clean.
  • cargo clippy --workspace --lib --examples --tests --benches --all-features -- -D warnings clean.

Closes #53

Move unit tests for public interfaces out of inline #[cfg(test)] modules
into an integration tests/ directory that mirrors src/, as proposed in
leanSig#53.

Migrated modules: array, inc_encoding/target_sum,
symmetric/prf/shake_to_field, symmetric/tweak_hash.

Modules still using crate-private helpers stay inline (simd_utils,
message_hash, tweak_hash/poseidon, tweak_hash_tree, signature, and the
generalized_xmss instantiations which rely on cfg(test) test_templates).

The test-only PoseidonMessageHash445 and PoseidonTweak44 aliases are
defined locally in their integration test files because the originals
are cfg(test) gated in the library.

Closes leanEthereum#53
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.

Migrate inline Rust tests to dedicated test directories

1 participant