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

fix: avoid div with zero in assert_approx_eq #2101

Merged
merged 3 commits into from
Apr 15, 2024
Merged

Conversation

Miyou
Copy link
Contributor

@Miyou Miyou commented Apr 10, 2024

Currently, when both values are zero assert_approx_eq fails due to division by zero rather than succeeding because the values are the same. This fixes that.

Copy link
Member

@webmaster128 webmaster128 left a comment

Choose a reason for hiding this comment

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

Nice find, thanks

packages/core/src/testing/assertions.rs Show resolved Hide resolved
@webmaster128 webmaster128 merged commit 23b1130 into CosmWasm:main Apr 15, 2024
30 checks passed
@webmaster128
Copy link
Member

@mergify backport release/2.0 release/1.5

Copy link
Contributor

mergify bot commented Apr 15, 2024

backport release/2.0 release/1.5

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Apr 15, 2024
* fix: avoid div with zero in assert_approx_eq

* test: Add tests for assert_approx_eq with zero

* refactor: Make equal check in assert_approx_eq more explicit

(cherry picked from commit 23b1130)
mergify bot pushed a commit that referenced this pull request Apr 15, 2024
* fix: avoid div with zero in assert_approx_eq

* test: Add tests for assert_approx_eq with zero

* refactor: Make equal check in assert_approx_eq more explicit

(cherry picked from commit 23b1130)
webmaster128 pushed a commit that referenced this pull request Apr 15, 2024
* fix: avoid div with zero in assert_approx_eq

* test: Add tests for assert_approx_eq with zero

* refactor: Make equal check in assert_approx_eq more explicit

(cherry picked from commit 23b1130)

Co-authored-by: Michael Young <2496187+Miyou@users.noreply.github.com>
webmaster128 pushed a commit that referenced this pull request Apr 15, 2024
* fix: avoid div with zero in assert_approx_eq

* test: Add tests for assert_approx_eq with zero

* refactor: Make equal check in assert_approx_eq more explicit

(cherry picked from commit 23b1130)

Co-authored-by: Michael Young <2496187+Miyou@users.noreply.github.com>
@webmaster128
Copy link
Member

Thank you. Nice improvement here. The patch is now backported to 2.0.x and 1.5.x and will be included in the next patch releases

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