Skip to content

Support BigDecimal in assert_in_delta and its family - #218

Merged
kou merged 6 commits into
test-unit:masterfrom
mrkn:assert_in_delta_bigdecimal
Oct 3, 2022
Merged

kou merged 6 commits into
test-unit:masterfrom
mrkn:assert_in_delta_bigdecimal

Conversation

@mrkn

@mrkn mrkn commented Sep 25, 2022 •

Copy link
Copy Markdown
Contributor

This accepts BigDecimal as input without converting Float implicitly for assert_in_delta and its family.

Comment thread lib/test/unit/assertions.rb Resolved
Comment thread lib/test/unit/assertions.rb Resolved
@mrkn
mrkn force-pushed the assert_in_delta_bigdecimal branch 2 times, most recently from 49164cf to 5b65b6f Compare September 27, 2022 00:19
@mrkn

mrkn commented Sep 27, 2022

Copy link
Copy Markdown
Contributor Author

@kou Now we don't have the requirements of to_f for each argument. So, do you think how we change _assert_in_delta_validate_arguments?

@kou

kou commented Sep 27, 2022

Copy link
Copy Markdown
Member

Could you execute _assert_in_delta_validate_arguments only in the rescue clause?

@mrkn
mrkn force-pushed the assert_in_delta_bigdecimal branch from 5b65b6f to 50281a4 Compare September 27, 2022 23:27
Comment thread lib/test/unit/assertions.rb Resolved
Comment thread lib/test/unit/assertions.rb Resolved
@mrkn
mrkn force-pushed the assert_in_delta_bigdecimal branch 3 times, most recently from b2a6a95 to 36453d4 Compare September 28, 2022 00:04
Comment thread lib/test/unit/assertions.rb Resolved
@mrkn
mrkn force-pushed the assert_in_delta_bigdecimal branch from 36453d4 to f1b2ac3 Compare September 28, 2022 00:10
@mrkn
mrkn marked this pull request as ready for review September 28, 2022 00:13
@mrkn
mrkn marked this pull request as draft September 28, 2022 00:14
@mrkn

mrkn commented Sep 28, 2022

Copy link
Copy Markdown
Contributor Author

By the way, why the CI workflow does not run?

@kou

kou commented Sep 28, 2022

Copy link
Copy Markdown
Member

By the way, why the CI workflow does not run?

Because you're a first-time contributor in this repository. :-)

@mrkn
mrkn force-pushed the assert_in_delta_bigdecimal branch from f1b2ac3 to b5960ca Compare September 29, 2022 00:30
@mrkn
mrkn force-pushed the assert_in_delta_bigdecimal branch from b5960ca to 9ddbb1b Compare September 29, 2022 15:20
@mrkn
mrkn requested a review from kou September 30, 2022 00:07
@mrkn
mrkn marked this pull request as ready for review September 30, 2022 00:08
@mrkn

mrkn commented Sep 30, 2022

Copy link
Copy Markdown
Contributor Author

@kou Could you please review the additional changes?

@kou

kou commented Sep 30, 2022

Copy link
Copy Markdown
Member

It looks good to me. Could you confirm a test failure with TruffleRuby: https://github.com/test-unit/test-unit/actions/runs/3155408344/jobs/5134120186#step:5:14

It seems that it's just a format difference.

@mrkn

mrkn commented Sep 30, 2022

Copy link
Copy Markdown
Contributor Author

@kou It doesn't seem a format difference, but it seems the delta is converted to a Float in the message.

I think a reasonable way to fix it is to disable test cases that depend on bigdecimal for JRuby and TruffleRuby.

Or, it can be an alternative way to replace BigDecimal with a dummy number class that was newly created for tests.

@kou

kou commented Sep 30, 2022

Copy link
Copy Markdown
Member

OK. Could you omit only Test::Unit::TestAssertInEpsilonBigDecimal#test_fail_with_float_like_object on TruffleRuby?

`TestAssertInEpsilonBigDecimal#test_fail_with_float_like_object` fails
only on TruffleRuby.  The reason of the failure is maybe `delta` is
converted to a Float accidentally on building the failure message.
@mrkn

mrkn commented Sep 30, 2022

Copy link
Copy Markdown
Contributor Author

@kou The test should have been omitted only on TruffleRuby by the last commit.

@mrkn mrkn changed the title WIP: Support BigDecimal in assert_in_delta Support BigDecimal in assert_in_delta Oct 1, 2022
@kou kou changed the title Support BigDecimal in assert_in_delta Support BigDecimal in assert_in_delta and its family Oct 1, 2022
Comment thread test/test-assertions.rb Resolved
@kou
kou merged commit ecbaafa into test-unit:master Oct 3, 2022
@kou

kou commented Oct 3, 2022

Copy link
Copy Markdown
Member

Thanks!

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