Assertions in UquoniTest
In UquoniTest assertions are modular. You may know this concept already from ModAssert. This means that the condition in the assertions can be replaced with a Rich Boolean, which is a macro that tests some condition, and if it fails it creates an analysis of the condition, which is handled by the assertion so you get more information about what went wrong. E.g.
uqtASSERT(a==1);
can be replaced with
uqtASSERT(rbEQUAL(a,1));
which will show the value of the variable a in the reports, which often avoids having to launch the debugger.
Other Rich Booleans can help you even more by checking conditions that would otherwise be hard to code, e.g. checking if a container is a subset of another container:
uqtASSERT(rbIN_CONTAINERS(vec1, vec2, IsSubsetOf<>()));
If not, it will tell you which elements of the subset are not in the superset. Others check whether two containers have the same elements (in the same order or not), whether a container contains a certain element, whether all elements in a container are unique, etc.
IsSubSetOf can be replaced with other things to check for equality, equality in different order, or other types of subsets, and more.
There are other Rich Booleans like rbIN_RANGES that takes begin and end iterators, rbIN_ARRAYS that works on arrays, and combinations of these to use different types together.
There are also Rich Booleans that perform checks on files and directories, e.g. whether a file exists
uqtASSERT(rbFILE_EXISTS("directory\\file.txt"));
and if it doesn't exist, it tells you which part of the path exists. Other Rich Booleans check whether a file is writable, readable or executable, on Linux even whether it is a link, a pipe, a regular device, etc.
In total there are over 80 Rich Booleans which allow you to do even more than described here.
This concept allows UquoniTest to have different assertion types without having to duplicate the functionality of every Rich Boolean. There are variations of uqtASSERT that continue the test after a failure:
uqtCASSERT(rbEQUAL(a,1));
that ignore the condition
uqtIGNORE_ASSERT(rbEQUAL(a,1));
which will give a warning so you don't forget about it, and assertions that give extra information
uqtASSERT_P(a << b, rbEQUAL(a+b,10));
which will show the values of a and b when the condition fails.