Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update package versions and adjust test assertions #67

Merged
merged 2 commits into from
Jul 9, 2024
Merged

Conversation

shuhuiluo
Copy link
Collaborator

@shuhuiluo shuhuiluo commented Jul 9, 2024

The package versions in Cargo.toml have been updated including 'bigdecimal', 'lazy_static', 'num-traits' and few others. In the same commit, the assertion methodology in the test cases for the 'Price' entity has been changed to increase precision. Also, the expected results for 'to_significant' tests have been replaced with new values in scientific notation.

Closes #57.

The package versions in Cargo.toml have been updated including 'bigdecimal', 'lazy_static', 'num-traits' and few others. In the same commit, the assertion methodology in the test cases for the 'Price' entity has been changed to increase precision. Also, the expected results for 'to_significant' tests have been replaced with new values in scientific notation.
@shuhuiluo shuhuiluo requested a review from malik672 July 9, 2024 06:58
@shuhuiluo shuhuiluo self-assigned this Jul 9, 2024
* Refactor code for fraction and percent tests

The brackets around the arithmetic operations in the fraction.rs and percent.rs test functions have been removed to improve readability. Also, in compute_price_impact.rs tests, the 'assert!' function has been replaced with 'assert_eq!' to enhance precision and clarity of the tests.

* Refactor `compute_price_impact` function

Simplify the `compute_price_impact` function by eliminating the need for manual error handling and using the question mark operator instead. This change also eliminates the need for clone of price impact, making the function more efficient and cleaner.

* Refactor `sqrt` function for `BigInt`

The square root function for BigInt has been simplified. The previous implementation used a combination of primitive sqrt for smaller values and Babylonian method for larger ones. Now, the function uses the in-built sqrt method regardless of the input size, simplifying the code and reducing potential errors.
@malik672 malik672 merged commit 167db5e into master Jul 9, 2024
2 checks passed
@malik672 malik672 deleted the deps branch July 9, 2024 11:31
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.

Upgrade bigdecimal to 0.4.3 and fix tests
2 participants