+/** \brief Initialize the log system */
+void yaz_check_init_log(const char *argv0)
+{
+ char logfilename[2048];
+ log_tests = 1;
+ sprintf(logfilename,"%s.log", progname(argv0) );
+ yaz_log_init_file(logfilename);
+ yaz_log_trunc();
+
+}
+
+void yaz_check_inc_todo(void)
+{
+ test_todo++;
+}
+
+void yaz_check_term1(void)
+{
+ /* summary */
+ if (test_failed)
+ {
+ if (test_verbose >= 1) {
+ if (test_todo)
+ fprintf(get_file(), "%d out of %d tests failed for program %s"
+ " (%d TODO's remaining)\n",
+ test_failed, test_total, test_prog,test_todo);
+ else
+ fprintf(get_file(), "%d out of %d tests failed for program %s\n",
+ test_failed, test_total, test_prog);
+ }
+ }
+ else
+ {
+ if (test_verbose >= 2) {
+ if (test_todo)
+ fprintf(get_file(), "%d tests passed for program %s"
+ " (%d TODO's remaining)\n",
+ test_total, test_prog,test_todo);
+ else
+ fprintf(get_file(), "%d tests passed for program %s\n",
+ test_total, test_prog);
+ }
+ }
+ if (test_fout)
+ fclose(test_fout);
+ if (test_failed)
+ exit(1);
+ exit(0);
+}
+
+void yaz_check_eq1(int type, const char *file, int line,
+ const char *left, const char *right, int lval, int rval)
+{
+ char formstr[2048];
+
+ if (type == YAZ_TEST_TYPE_OK)
+ sprintf(formstr, "%.500s == %.500s ", left, right);
+ else
+ sprintf(formstr, "%.500s != %.500s\n %d != %d", left, right, lval,rval);
+ yaz_check_print1(type, file, line, formstr);
+}
+
+void yaz_check_print1(int type, const char *file, int line,
+ const char *expr)