- osg::Vec4 objects can't be output to a stream -> use the _NOSTREAM
variant of the test macro.
- ditto for the NULL... thing -> use SG_CHECK_IS_NULL().
- Add an _NOSTREAM variant for each macro (except for SG_TEST_FAIL, that
doesn't take any argument, and for SG_VERIFY, which doesn't attempt to
print its argument to a stream---doesn't sound very useful). So, if a
and b can be output to a stream (without any undesirable side effect,
of course), use for instance SG_CHECK_EQUAL(a, b); otherwise, use
SG_CHECK_EQUAL_NOSTREAM(a, b).
- Add test macros SG_CHECK_IS_NULL, SG_CHECK_IS_NULL_NOSTREAM,
SG_CHECK_IS_NOT_NULL and SG_CHECK_IS_NOT_NULL_NOSTREAM.
- Add a few comments.
- Because of possible operator overloading, make SG_CHECK_EQUAL(a, b)
fail if, and only if (a) == (b) is false (testing if (a) != (b) for
this macro is not correct in general).
- For clarity and consistency, change the messages printed when some
tests fail: SG_VERIFY(some_test) prints 'failed: some_test' (okay),
but SG_CHECK_EQUAL(a, b) used to print 'failed: a != b', which is
inconsistent. Instead, print: 'failed: a == b' because this is what we
know that failed (again, because of possible operator overloading,
pretending we know the the logical value of (a != b) after testing
(a == b) is not correct in general.
Similarly, the "approximate equality tests" SG_CHECK_EQUAL_EP() and
SG_CHECK_EQUAL_EP2() now print something like 'failed: a ~= b' when
they fail, instead of 'failed with epsilon: a != b'.
- The header is needed for std::cerr.
- Also improve the messages when tests fail (spacing, and in some cases
an argument was missing).
- Reorder the macros a tiny bit.
Some of the modules where I previously removed duplicate private
definitions of these macros had these features, and since they seem wise
to me, I'm applying them to the canonical SG_CHECK_EQUAL_EP() and
SG_CHECK_EQUAL_EP2() macros defined in simgear/misc/test_macros.hxx.
COMPARE -> SG_CHECK_EQUAL
COMPARE_EP -> SG_CHECK_EQUAL_EP
COMPARE_EP2 -> SG_CHECK_EQUAL_EP2
VERIFY -> SG_VERIFY
Also remove duplicate private definitions of these macros in test
modules, using instead those defined in simgear/misc/test_macros.hxx.