sheredom / utest.h

🧪 single header unit testing framework for C and C++
The Unlicense
834 stars 57 forks source link

Add *_PRED_* tests: A predicate test that uses a provided function for comparing values #146

Open bluehazzard opened 7 months ago

bluehazzard commented 7 months ago

Uses a provided function that returns bool (or int in c) to compare provided test values

This is useful if you want compare some complex values, or for example a float in a range not only near a delta ecc... See test case for examples

bluehazzard commented 7 months ago

This seems to be more complex than i thought... I can not test MS compiler locally, so it worked fine for me and i was thinking i can make a pull request. Will try to fix the error tomorrow CET

bluehazzard commented 7 months ago

Ok, clang and gcc should now work. I can not test ms compilers and the automated test on appveyor seems to fail in places i did not modify?

'PRED' should be short for 'predicate'... the first thing went in my mind, it could probably also be called FUNC...

sheredom commented 7 months ago

MSVC on appveyor is failing because the oldest MSVCs I support (2008 & 2010) doesn't have support for lambdas I think. We'll need to gate those tests on newer MSVC versions.

sheredom commented 7 months ago

Yeah PRED is fine now I've bikeshedded for a while. I think its as descriptive as we can hope for.