[test] Add more tests for multiply()
#32
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request primarily focuses on adding comprehensive tests for the multiplication operation of the
Decimaltype and refactoring some related code. The most important changes include adding a new test file for multiplication, updating themultiplyfunction to simplify its logic, and removing old multiplication tests from thetest_arithmetics.mojofile.Addition of Comprehensive Multiplication Tests:
tests/test_multiply.mojo: Added a new file with detailed tests for theDecimalmultiplication 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 themultiplyfunction by directly returning a newDecimalinstance for the zero case, removing the need for intermediate variables.Removal of Redundant Tests:
tests/test_arithmetics.mojo: Removed the oldtest_multiplicationfunction and its invocation in themainfunction, as these tests have been replaced by the new comprehensive tests intests/test_multiply.mojo. [1] [2]Miscellaneous Updates:
benches/bench.mojo: Addedbench_roundto the list of benchmarks and included it in themainfunction to ensure it is executed. [1] [2]mojoproject.toml: Added a new commandtest_multiplyto run the multiplication tests.