utest.h icon indicating copy to clipboard operation
utest.h copied to clipboard

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

Open bluehazzard opened this issue 1 year ago • 4 comments

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 avatar Feb 13 '24 22:02 bluehazzard

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 avatar Feb 13 '24 23:02 bluehazzard

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...

bluehazzard avatar Feb 15 '24 21:02 bluehazzard

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 avatar Feb 20 '24 15:02 sheredom

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

sheredom avatar Feb 22 '24 15:02 sheredom