Re: [Chicken-users] Using epsilon in test egg

2014-07-30 Thread Peter Bex
On Mon, Jul 28, 2014 at 09:46:57PM +0900, Alex Shinn wrote: Regardless, I'll add a utility to make defining tests with your own comparator easier, and explicitly export test-approx-equal? so you don't have to capture the initial test comparator. While you're looking at that, could you also

Re: [Chicken-users] Using epsilon in test egg

2014-07-30 Thread John Cowan
Peter Bex scripsit: While you're looking at that, could you also take a look at this ticket? https://bugs.call-cc.org/ticket/935 In addition, the page on comparing floats that you pointed to now has a replacement:

Re: [Chicken-users] Using epsilon in test egg

2014-07-30 Thread Alex Shinn
On Wed, Jul 30, 2014 at 9:33 PM, John Cowan co...@mercury.ccil.org wrote: Peter Bex scripsit: While you're looking at that, could you also take a look at this ticket? https://bugs.call-cc.org/ticket/935 That was from 22 months ago... I don't remember exactly when it was fixed but it works

Re: [Chicken-users] Using epsilon in test egg

2014-07-30 Thread Peter Bex
On Wed, Jul 30, 2014 at 10:00:00PM +0900, Alex Shinn wrote: On Wed, Jul 30, 2014 at 9:33 PM, John Cowan co...@mercury.ccil.org wrote: Peter Bex scripsit: While you're looking at that, could you also take a look at this ticket? https://bugs.call-cc.org/ticket/935 That was from 22

Re: [Chicken-users] Using epsilon in test egg

2014-07-30 Thread Alaric Snell-Pym
On 29/07/14 04:58, Alex Shinn wrote: On Mon, Jul 28, 2014 at 10:09 PM, John Cowan co...@mercury.ccil.org mailto:co...@mercury.ccil.org wrote: Alex Shinn scripsit: If people think it's useful I'd consider walking pairs and vectors. They are the most important cases, because the

Re: [Chicken-users] Using epsilon in test egg

2014-07-28 Thread John Cowan
Alex Shinn scripsit: The solution is definitely not to write your own comparison function, and trust that the test egg is doing the right thing. It isn't, though, not quite. What it needs to do is not a dichotomy of if inexact, use epsilon, otherwise use `equal?` but rather to have a version

Re: [Chicken-users] Using epsilon in test egg

2014-07-28 Thread Alex Shinn
On Mon, Jul 28, 2014 at 9:30 PM, John Cowan co...@mercury.ccil.org wrote: Alex Shinn scripsit: The solution is definitely not to write your own comparison function, and trust that the test egg is doing the right thing. It isn't, though, not quite. What it needs to do is not a dichotomy

Re: [Chicken-users] Using epsilon in test egg

2014-07-28 Thread John Cowan
Alex Shinn scripsit: If people think it's useful I'd consider walking pairs and vectors. They are the most important cases, because the expected value is expressed as a literal value, and that can only be a list or vector. If you are using `test-assert`, you can specify your own function

Re: [Chicken-users] Using epsilon in test egg

2014-07-28 Thread Alex Shinn
On Mon, Jul 28, 2014 at 10:09 PM, John Cowan co...@mercury.ccil.org wrote: Alex Shinn scripsit: If people think it's useful I'd consider walking pairs and vectors. They are the most important cases, because the expected value is expressed as a literal value, and that can only be a list or

Re: [Chicken-users] Using epsilon in test egg

2014-07-27 Thread Alex Shinn
On Sun, Jul 27, 2014 at 10:03 AM, Matt Gushee m...@gushee.net wrote: Hmm, just realized something. The test egg documentation also says: Percentage difference allowed ... So if the expected value is 0, then no variance is allowed? If that's true, then epsilon isn't what I want anyway. I

[Chicken-users] Using epsilon in test egg

2014-07-26 Thread Matt Gushee
Hi, folks-- I am working on an application that does a lot of floating-point calculations, and I'm having trouble with the test suite. The program is based on the imlib2 egg, and it does some fairly simple image processing for web applications, so the numbers in question are RGBA color values.

Re: [Chicken-users] Using epsilon in test egg

2014-07-26 Thread Alaric Snell-Pym
On 27/07/14 01:42, Matt Gushee wrote: I can certainly define a custom equality predicate that will do what I need, but this is bugging me. I guess I don't really understand how epsilon is supposed to work. The test egg documentation says that applies to 'inexact comparisons', but I can't find

Re: [Chicken-users] Using epsilon in test egg

2014-07-26 Thread Matt Gushee
Hmm, just realized something. The test egg documentation also says: Percentage difference allowed ... So if the expected value is 0, then no variance is allowed? If that's true, then epsilon isn't what I want anyway. I need to allow an absolute amount of variance that is independent of the

Re: [Chicken-users] Using epsilon in test egg

2014-07-26 Thread Alex Charlton
Hi Matt, The problem you’re having is because test only uses the approximate comparison (using current-test-epsilon) when the _expected_ value is inexact: http://api.call-cc.org/doc/scheme/inexact%3F Since your expected value is a list (i.e. inexact? will result in #f given a list), test is

Re: [Chicken-users] Using epsilon in test egg

2014-07-26 Thread Matt Gushee
On Sat, Jul 26, 2014 at 6:57 PM, Alaric Snell-Pym ala...@snell-pym.org.uk wrote: It's probably best to define your own equality predicate, I think! Yes, I think you're right. Thanks! ___ Chicken-users mailing list Chicken-users@nongnu.org

Re: [Chicken-users] Using epsilon in test egg

2014-07-26 Thread Matt Gushee
Hi, John-- On Sat, Jul 26, 2014 at 7:47 PM, John Cowan co...@mercury.ccil.org wrote: Matt Gushee scripsit: Other posters have addressed the main issues, but I'll just point out that inexact comparison means comparison for equality of inexact numbers. Epsilon is applied only by the default

Re: [Chicken-users] Using epsilon in test egg

2014-07-26 Thread Alex Charlton
Matt Gushee writes: I guess my explanation wasn't entirely clear, but that's pretty much what I was already doing. I showed the equality predicate I was using, which tests individual values in the list with = . I think my mistake was in assuming that (current-test-epsilon) would apply to =

Re: [Chicken-users] Using epsilon in test egg

2014-07-26 Thread Alex Shinn
On Sun, Jul 27, 2014 at 10:03 AM, Matt Gushee m...@gushee.net wrote: Hmm, just realized something. The test egg documentation also says: Percentage difference allowed ... So if the expected value is 0, then no variance is allowed? Naturally we handle this case correctly and check the

Re: [Chicken-users] Using epsilon in test egg

2014-07-26 Thread Alex Shinn
On Sun, Jul 27, 2014 at 11:02 AM, Alex Charlton alex.n.charl...@gmail.com wrote: Matt Gushee writes: I guess my explanation wasn't entirely clear, but that's pretty much what I was already doing. I showed the equality predicate I was using, which tests individual values in the list with