--- a/src/test/test.c Fri May 08 00:11:35 2009 +0300
+++ b/src/test/test.c Fri May 08 00:12:15 2009 +0300
@@ -75,6 +75,18 @@
}
/**
+ * Run the given test, updating the given counter
+ */
+static void run_test (const struct test *test, size_t *test_count)
+{
+ log_info("%s", test->name);
+
+ // count and run
+ (*test_count)++;
+ test->func();
+}
+
+/**
* Run the given NULL-terminated list of tests, optionally filtering against the given filter.
*
* Returns the number of tests run, which may be zero.
@@ -89,12 +101,9 @@
// filter out if given
if ((filter && strcmp(test->name, filter)) || (!filter && test->optional))
continue;
-
- log_info("Running test: %s", test->name);
- // count and run
- test_count++;
- test->func();
+ // run it
+ run_test(test, &test_count);
}
return test_count;