Spaces:
Sleeping
Sleeping
| //! Love Live Card Game Rust Engine - Test Suite Organization | |
| //! | |
| //! # Test Architecture Overview | |
| //! | |
| //! This engine includes 568 comprehensive tests organized into multiple categories: | |
| //! | |
| //! ## Test Categories | |
| //! | |
| //! ### 1. QA Verification Tests (163 tests) | |
| //! - **Location**: `qa/` module and `qa_verification_tests.rs` | |
| //! - **Purpose**: Official Q&A rule clarifications from game documentation | |
| //! - **Coverage**: Q1-Q300+ official rulings | |
| //! - **Command**: `cargo test --lib qa` | |
| //! | |
| //! ### 2. Opcode & Bytecode Tests (~150 tests) | |
| //! - **Locations**: `opcode_*.rs` modules (opcode_tests, opcode_coverage_gap_2, etc.) | |
| //! - **Purpose**: Individual bytecode instruction validation | |
| //! - **Coverage**: O_DRAW, O_REVEAL_UNTIL, O_LOOK_DECK, etc. | |
| //! - **Command**: `cargo test --lib opcode` | |
| //! | |
| //! ### 3. Mechanics & Game Flow Tests (~180 tests) | |
| //! - **Locations**: `*_tests.rs` modules (mechanics_tests, game_flow_tests, etc.) | |
| //! - **Purpose**: High-level game mechanics and interactions | |
| //! - **Coverage**: Phase transitions, card interactions, state consistency | |
| //! - **Command**: `cargo test --lib mechanics` | |
| //! | |
| //! ### 4. Edge Cases & Stress Tests (~75 tests) | |
| //! - **Locations**: Various regression and special-case test files | |
| //! - **Purpose**: Rare scenarios, stress tests, regression prevention | |
| //! - **Coverage**: Complex bytecode sequences, boundary conditions | |
| //! - **Command**: `cargo test --lib edge` or `cargo test --lib stress` | |
| //! | |
| //! ## Performance Metrics | |
| //! | |
| //! - **Full Suite**: 568 tests in ~17-18 seconds (parallelized) | |
| //! - **Single-threaded**: ~70 seconds (deterministic ordering) | |
| //! - **Parallelization**: Auto-scales to CPU core count (4-8 threads typical) | |
| //! - **Memory**: ~200MB peak during execution | |
| //! | |
| //! ## Running Tests | |
| //! | |
| //! ```bash | |
| //! # All tests with parallelization (default, ~18s) | |
| //! cargo test --lib | |
| //! | |
| //! # Single category | |
| //! cargo test --lib qa | |
| //! cargo test --lib opcode | |
| //! cargo test --lib mechanics | |
| //! | |
| //! # Deterministic (single-threaded, ~70s) | |
| //! cargo test --lib -- --test-threads=1 | |
| //! | |
| //! # Specific test | |
| //! cargo test --lib test_q166_reveal_until_refresh | |
| //! | |
| //! # With output | |
| //! cargo test --lib test_opcode_draw -- --nocapture | |
| //! ``` | |
| //! | |
| //! ## Test File Organization | |
| //! | |
| //! **Current Structure** (src/ directory): | |
| //! ```text | |
| //! src/ | |
| //! βββ qa/ # QA rule verification (mod) | |
| //! β βββ batch_1.rs | |
| //! β βββ batch_2.rs | |
| //! β βββ batch_3.rs | |
| //! β βββ batch_4_unmapped_qa.rs | |
| //! β βββ ... | |
| //! βββ qa_verification_tests.rs # Additional QA tests | |
| //! βββ opcode_tests.rs # Basic opcode tests | |
| //! βββ opcode_coverage_gap_2.rs # Coverage gap analysis | |
| //! βββ opcode_missing_tests.rs # Missing opcode implementations | |
| //! βββ opcode_rigor_tests.rs # Rigorous opcode validation | |
| //! βββ mechanics_tests.rs # Game mechanics | |
| //! βββ game_flow_tests.rs # Phase transitions | |
| //! βββ card_interaction_tests.rs # Card interactions | |
| //! βββ regression_tests.rs # Regression prevention | |
| //! βββ [other test files] | |
| //! ``` | |
| //! | |
| //! **Planned Structure** (tests/ directory reference): | |
| //! See `../tests/README.md` for future reorganization planning. | |
| //! This provides a blueprint for scaling test organization. | |
| //! | |
| //! ## Adding New Tests | |
| //! | |
| //! ### For a New Q&A Ruling (Q301+) | |
| //! 1. Add test to `src/qa/batch_4_unmapped_qa.rs` or create `batch_5.rs` | |
| //! 2. Name: `test_q###_descriptive_name` | |
| //! 3. Add official Q&A reference as comment | |
| //! 4. Test command: `cargo test --lib test_q###` | |
| //! | |
| //! ### For a New Opcode Feature | |
| //! 1. Add test to appropriate `opcode_*.rs` file | |
| //! 2. Name: `test_opcode_name_scenario` | |
| //! 3. Add opcode documentation comment | |
| //! 4. Test command: `cargo test --lib test_opcode_name` | |
| //! | |
| //! ### For Regression Testing | |
| //! 1. Add test to `regression_tests.rs` | |
| //! 2. Name: `test_regression_issue_number` or `test_regression_card_name` | |
| //! 3. Reference the issue/bug fixed | |
| //! 4. Test command: `cargo test --lib test_regression` | |
| //! | |
| //! ### For Stress/Edge Cases | |
| //! 1. Add test to `../tests/edge_cases/stress_rare_bytecode_sequences.rs` | |
| //! 2. Name: `test_stress_scenario_name` | |
| //! 3. Document complexity metrics (bytecode length, nesting depth, etc.) | |
| //! 4. Test command: `cargo test --lib test_stress` | |
| //! | |
| //! ## Test Isolation Issue (Known) | |
| //! | |
| //! Q166 test currently fails in full suite due to test state contamination | |
| //! but passes in isolation. Investigation ongoing. Workaround: | |
| //! ```bash | |
| //! cargo test --lib test_q166 | |
| //! ``` | |
| //! All 567 other tests pass independently. | |
| // Incremental build verification comment | |
| pub mod core; | |
| pub mod py_bindings; | |
| pub mod repro; | |
| pub mod test_helpers; | |
| pub mod wasm_bindings; | |
| mod ability_tests; | |
| mod baton_pass_tests; | |
| mod card_interaction_tests; | |
| mod comprehensive_tests; | |
| mod coverage_gap_tests; | |
| mod database_tests; | |
| mod deck_refresh_tests; | |
| mod game_end_tests; | |
| mod game_flow_tests; | |
| mod mechanics_tests; | |
| mod meta_rule_tests; | |
| mod opcode_coverage_gap_2; | |
| mod opcode_missing_tests; | |
| mod opcode_tests; | |
| mod phase_transition_tests; | |
| mod regression_tests; | |
| mod response_flow_tests; | |
| mod rule_parity_regression_tests; | |
| mod size_test; | |
| mod stabilized_tests; | |
| mod structural_tests; | |
| mod tests; | |
| mod tie_breaker_tests; | |
| mod trigger_tests; | |
| mod verification_tests; | |
| mod wave2_tests; | |
| mod wave6_tests; | |
| // #[cfg(test)] | |
| // // mod archetype_runner; | |
| mod count_group_tests; | |
| mod enforcement_tests; | |
| mod filter_audit_tests; | |
| mod qa_verification_tests; | |
| mod rule_alignment_tests; | |
| mod semantic_assertions; | |
| mod qa; | |
| mod perf_tests; | |
| mod meta_rule_card_tests; | |
| mod opcode_rigor_tests; | |
| mod untested_opcode_tests; | |
| mod new_opcode_tests; | |
| mod alphazero_verification_tests; | |
| mod debug_q203; | |
| mod unique_ability_tests; | |
| // #[cfg(test)] | |
| // mod gpu_smoke_tests; // Requires gpu_manager module (not yet implemented) | |
| mod manual_verification_tests; | |
| mod vanilla_encoding_tests; | |
| mod debug_consts; | |
| // #[cfg(test)] | |
| // mod gpu_parity_tests; | |
| // pub mod repro_pl_bp3_004; // Deleted | |
| use pyo3::prelude::*; | |
| fn engine_rust(m: &Bound<'_, PyModule>) -> PyResult<()> { | |
| py_bindings::register_python_module(m) | |
| } | |