[erlang-questions] how: best way to deal with floats in eunit?

Tim Fletcher <>
Tue Aug 12 15:03:13 CEST 2008


I'm trying to write a test for a function that should return something
like [{1, 0.1}], but because a float is being returned the exact value
won't always be the same (and so I can't use ?_assertEqual).

eunit doesn't appear to have anything built-in that will handle a case
like this, and the nested structure makes writing a custom assertion a
bit awkward.

I can't imagine this is the first time anyone has used floats in
eunit... any suggestions as to the best way to tackle this?



More information about the erlang-questions mailing list