mr-sun / hamcrest

Hamcrest matchers for c++ (using with carnamock)
0 stars 0 forks source link

Enhance the closeTo matcher to be able to handle BigDecimals, also provide a possibility to compare BigDecimals. #177

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Would be nice to have the closeTo(double, double) matcher also for BigDecimals. 
Please see the attachment as an example implementation.

Also it would be nice to have a matcher that does the comparision of 
BigDecimals based on the compareTo method. See also the attachment as an 
example implementation.

Original issue reported on code.google.com by mario.ho...@gmail.com on 5 Mar 2012 at 10:27

Attachments:

GoogleCodeExporter commented 8 years ago
any chance you could send me a pull request in GitHub? 
https://github.com/hamcrest/JavaHamcrest

b.t.w. don't forget to write the tests.

Original comment by smgfree...@gmail.com on 25 Apr 2012 at 10:50

GoogleCodeExporter commented 8 years ago
tag as java

Original comment by t.denley on 12 May 2012 at 10:09

GoogleCodeExporter commented 8 years ago
The last sentence of my initial request can be ignored (where i was asking for 
a possibility to do comparision of BigDecimals by compareTo instead of equal). 
I just learned about the OrderingComparison class, which can exactly do that 
e.g. assertThat(new BigDecimal("2"), comparesEqualTo(new BigDecimal("2.000")));

Original comment by mario.ho...@gmail.com on 29 May 2012 at 8:01

GoogleCodeExporter commented 8 years ago
Thanks for the pull request.  I have merged this on commit 
https://github.com/hamcrest/JavaHamcrest/commit/2419f482baaea2bed68175fa2bb571f8
3acc0be3

Original comment by t.denley on 31 May 2012 at 7:33