Skip to content

Conversation

@forfudan
Copy link
Owner

This pull request primarily focuses on adding comprehensive tests for the multiplication operation of the Decimal type and refactoring some related code. The most important changes include adding a new test file for multiplication, updating the multiply function to simplify its logic, and removing old multiplication tests from the test_arithmetics.mojo file.

Addition of Comprehensive Multiplication Tests:

  • tests/test_multiply.mojo: Added a new file with detailed tests for the Decimal multiplication operation, covering basic multiplication, special cases, negative numbers, precision and scale handling, boundary values, and the commutative property.

Code Simplification:

  • src/decimojo/arithmetics.mojo: Simplified the multiply function by directly returning a new Decimal instance for the zero case, removing the need for intermediate variables.

Removal of Redundant Tests:

  • tests/test_arithmetics.mojo: Removed the old test_multiplication function and its invocation in the main function, as these tests have been replaced by the new comprehensive tests in tests/test_multiply.mojo. [1] [2]

Miscellaneous Updates:

  • benches/bench.mojo: Added bench_round to the list of benchmarks and included it in the main function to ensure it is executed. [1] [2]
  • mojoproject.toml: Added a new command test_multiply to run the multiplication tests.

@forfudan forfudan merged commit c2c406e into main Mar 15, 2025
1 of 2 checks passed
@forfudan forfudan deleted the work branch March 15, 2025 19:43
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