+error messages relevant to the test system should be
+printed to standard out (fd 1)
+
+src/functional/test.h usage:
+
+use error in tests when possible instead of printf
+(error truncates the formatted string to 512 bytes and uses a
+single write call to output it to fd 1, terminating the error
+string with a \n is the responsibility of the caller)
+and return test_status from main (set by error, 0 by default)
+
+when many similar checks are done, helper macros can be used like
+#define T1(a,b) (check(a,b) || (error("check(%s,%s) failed\n", a, b),0))
+#define T2(f,w) (result=(f), result==(w) || (error("%s failed: got %s, want %s\n", #f, result, w),0))
+
+a simple example:
+
+#include "test.h"
+#define T(c,...) ((c) || (error(#c " failed: " __VA_ARGS__),0))
+int main(void)
+{
+ T('a'+1=='b', "'a'==%d 'b'==%d\n", 'a', 'b');
+ T(-5%3==-2, "bad mod semantics\n");
+ return test_status;
+}