Re: [racket] rackunit question

2013-12-21 Thread Evan Donahue
check out the main submodule. On Sat, Dec 21, 2013 at 10:47 PM, Manfred Lotz wrote: > Hi there, > In a small program I like to have the test cases in the same file. How > can I prevent the 'main' function of my program to be run when I do a > raco test? > > > Here is a minimal example: > > #lang

[racket] rackunit question

2013-12-21 Thread Manfred Lotz
Hi there, In a small program I like to have the test cases in the same file. How can I prevent the 'main' function of my program to be run when I do a raco test? Here is a minimal example: #lang racket (define (myfun) (displayln "hey")) (myfun) (module+ test (require rackunit) (

Re: [racket] unit test for close enough values

2013-12-21 Thread Neil Toronto
You've got yourself a tricky problem, here. The accepted way to compare how close two vectors or matrices are is to compute the norm of their difference - basically, the distance between them. The functions `matrix-absolute-error' and `matrix-relative-error' in `math/matrix' do that, and handl

Re: [racket] info.rkt `deps` (was: Package fails to compile during 'make in-place' but not 'raco pkg install')

2013-12-21 Thread Greg Hendershott
To loop back on this: I updated the info.rkt for all my packages. I also submitted PRs or requests for a couple packages I depend on, which were missing this. Because one consequence of this idea... > So: In my .travis.yml files I already run `raco pkg install`. What I > think I will do is also

Re: [racket] unit test for close enough values

2013-12-21 Thread J G Cho
That looks very useful. On Sat, Dec 21, 2013 at 6:23 PM, Greg Hendershott wrote: > > check-= wants single value but unfortunately my values are wrapped in > set of vectors. > > Oh I didn't notice that. > > In that case you could define your own check -- that looks inside the > sets and vectors

Re: [racket] unit test for close enough values

2013-12-21 Thread Greg Hendershott
> check-= wants single value but unfortunately my values are wrapped in set of > vectors. Oh I didn't notice that. In that case you could define your own check -- that looks inside the sets and vectors to do the approximate equality test -- using the second variant of `define-binary-check` as de

Re: [racket] unit test for close enough values

2013-12-21 Thread J G Cho
check-= wants single value but unfortunately my values are wrapped in set of vectors. On Sat, Dec 21, 2013 at 5:04 PM, Greg Hendershott wrote: > On Sat, Dec 21, 2013 at 3:42 PM, J G Cho wrote: > > FAILURE > > actual: # > #(0.7071067811865476 -0.7071067811865476)> > > expected: # > #(0.

Re: [racket] unit test for close enough values

2013-12-21 Thread Greg Hendershott
On Sat, Dec 21, 2013 at 3:42 PM, J G Cho wrote: > FAILURE > actual: # #(0.7071067811865476 -0.7071067811865476)> > expected: # #(0.7071067811865475 -0.7071067811865475)> > > Is there something like "check-close-enough?" in rackunit? I think you want check-= http://docs.racket-lang.org/rack

[racket] unit test for close enough values

2013-12-21 Thread J G Cho
I have a test that fails. (module+ test (check-equal? (list->set (vector-2d-orthogonals (vector 1 1))) (list->set (list (vector-unit (vector -1 1))