How to check a map roughly
Closed this issue · 4 comments
viebel commented
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...
rafaeldff commented
Hi @viebel, you can use midje's collection matchers such as:
(fact {:a 1000.00002 :b 1} => (just {:a (roughly 1000) :b 1}))
viebel commented
Thanks @rafaeldff
Do you know why the following doesn't work?
{:a 1000.00002 :b 1} => (just {:a (roughly 1000) :b 1})
marick commented
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
viebel commented
ok. cool