Unit Tests In Rust

In this post we will continue with the development of a small Rust crate called FuzzyComp. In the first part we wrote some code and now we want to make sure it works. There are several levels at which we can test, from the entire application down to each individual component. This blog is about writing tests for a single function. Luckily for us, Rust already comes with a very powerful multi-threaded unit test engine that we can easily use out of the box.

(more…)

Compare Floats – FuzzyComp

The act of comparing two numbers may seem like a trivial task if we do not think about it too much. From an early age, we know what is more, less, or equal when it comes to numbers. But what happens when we leave the world of pure, simple mathematics and enter our messy world with its variety of approximations and fuzziness? Quite often we end up with a notion of “close enough”.

(more…)
Vivaldi