marick/Midje

How to check a map roughly

Closed this issue · 4 comments

Hi,

Wonderful lib!

I'd like to know how to check a map roughly.

Something like:

(fact {:a 0.00002 :b 1} => (roughly {:a 0 :b 1})

But roughly accepts only number...

Hi @viebel, you can use midje's collection matchers such as:

(fact {:a 1000.00002 :b 1} => (just {:a (roughly 1000) :b 1}))

Thanks @rafaeldff
Do you know why the following doesn't work?

{:a 1000.00002 :b 1} => (just {:a (roughly 1000) :b 1})

I just tried that (but not with the latest Midje), and it worked:

user=> (fact {:a 1000.00002 :b 1} => (just {:a (roughly 1000) :b 1}))
true

ok. cool