Skip to content

Feat: Round Validation System Implementation - #144

Merged
manlikeHB merged 5 commits into
songifi:refac/modular-architecturefrom
No-bodyq:refac/modular-architecture
Aug 12, 2025
Merged

Feat: Round Validation System Implementation#144
manlikeHB merged 5 commits into
songifi:refac/modular-architecturefrom
No-bodyq:refac/modular-architecture

Conversation

@No-bodyq

Copy link
Copy Markdown
Contributor

closes #126

This PR adds comprehensive validation logic for the RoundConfig struct through the new validate_config function, along with a full suite of unit tests to ensure proper configuration rules are enforced.

Changes Made

  • Implemented validate_config to check for invalid game configuration values:
    • Wager amount cannot be zero.
    • Solo mode must have exactly 1 player.
    • Player count must be between 1 and 50.
    • Cards per round must be between 1 and 100.
    • Card timeout must be greater than zero.
    • Challenge type/parameter validation:
      • Enforces required params based on challenge type.
      • Rejects extra params for challenges that don’t require them.
      • Ensures param values are non-zero when required.
      • Prevents params from being set for Random challenges.
      • Enforces both params for GenreAndDecade challenges.
  • Created create_base_config helper to simplify test setup.
  • Added full test coverage for all validation rules.

Testing

  • Added unit tests covering all possible validation cases.
  • Verified valid configurations pass and all invalid configurations return the correct error message.

@No-bodyq

Copy link
Copy Markdown
Contributor Author

Kindly review @manlikeHB

Comment thread src/models/round/round.cairo Outdated
@No-bodyq
No-bodyq requested a review from manlikeHB August 12, 2025 15:49

@manlikeHB manlikeHB left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! LGTM!

@manlikeHB
manlikeHB merged commit c4173d2 into songifi:refac/modular-architecture Aug 12, 2025
1 check passed
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.

2 participants