Hey guys, is there any built-in way to assert equa...
# announcements
j
Hey guys, is there any built-in way to assert equality of doubles/floats in Kotlin tests? I'm especially interested in the JVM platform, but if there are some multiplatform ways from
kotlin-test
I'd be happy to learn about them.
s
Other than
.equals()
?
j
AFAIK,
equals
doesn't account for the imprecision of floating point values, does it? At least,
assertEquals()
fails for my current values because of rounding/truncation errors.
w
j
Yes, I could directly use this one, indeed. I just hoped there was an equivalent in
kotlin.test
😞
s
The assertions on kotlin seems quite bare but there is nothing wrong with using your own.
👍 1
j
I think I'll just go with the Junit one for now, since I'm using junit anyway under the hood
w
I've been using AssertJ which is probably no help to you
j
Indeed. I mean, as long as I already have JUnit and its assertions, there is no point for me to add any other library for now. I'd rather keep my dependencies small.