osiewicz / Statula

Unix command line tool for statistics.
MIT License
7 stars 10 forks source link

Make eprintf-calling functions easier to test #4

Open osiewicz opened 6 years ago

osiewicz commented 6 years ago

As of today there is no unified interface for mock error values - functions can either return NULL or (in case of value-returning functions), arbitrary values - however, there is no consistency with these and so, we'll need something like macros to help us solve these. exit function in eprintf has a magic number of '2' which is not okay. I want it to signal something so that bash scripting can be made a tad bit easier.

tersers commented 6 years ago

Would it be possible to handle mocking outside of the library code? Some quick googling: https://cmocka.org https://cgreen-devs.github.io

Alternatively, the library itself could be written in C but testing can easily be done in C++.

osiewicz commented 6 years ago

I'm not sure if we are on the same page - Criterion is the library of choice for that project, however eprintf usage restricts our testing capabilities.