* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
-#include <stdio.h>
-#include <glib.h>
-#include <getopt.h>
+#include <config.h>
#include "test.h"
+
+#ifndef DRIVER_EXTERNAL_TESTS
#include "tests.h"
+#endif
+
+#include <stdio.h>
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+
+#if defined(HAVE_UNISTD_H)
+#include <unistd.h>
+#endif
+
+#ifndef DRIVER_NAME
+#define DRIVER_NAME "EGlib"
+#endif
typedef struct _StringArray {
gchar **strings;
return array;
}
+gint global_passed = 0, global_tests = 0;
+
static void
string_array_free(StringArray *array)
{
printf("\n");
}
+#ifdef DRIVER_EXTERNAL_MAIN
+gint run_tests_main(gint argc, gchar **argv)
+#else
gint main(gint argc, gchar **argv)
+#endif
{
gint i, j, c, iterations = 1;
StringArray *tests_to_run = NULL;
gboolean global_failure = FALSE;
gboolean no_final_time_labels = FALSE;
gboolean debug = FALSE;
-
+
+#if HAVE_GETOPT_H
static struct option long_options [] = {
{"help", no_argument, 0, 'h'},
{"time", no_argument, 0, 't'},
tests_to_run = string_array_append(tests_to_run, argv[i]);
}
+#endif
time_start = get_timestamp();
for(k = 0; k < tests_to_run->length; k++) {
gchar *user = tests_to_run->strings[k];
const gchar *table = test_groups[j].name;
- gint user_len = strlen(user);
- gint table_len = strlen(table);
+ size_t user_len = strlen(user);
+ size_t table_len = strlen(table);
if(strncmp(user, table, table_len) == 0) {
if(user_len > table_len && user[table_len] != ':') {
}
if(run) {
+ gboolean passed;
gchar **split = NULL;
if(debug && test_groups[j].handler != fake_tests_init) {
}
}
- gboolean passed = run_group(&(test_groups[j]),
+ passed = run_group(&(test_groups[j]),
iterations, quiet, report_time, tests);
if(tests != NULL) {
}
if(!quiet) {
+ gdouble pass_percentage = ((gdouble)global_passed / (gdouble)global_tests) * 100.0;
printf("=============================\n");
- printf("Overall result: %s\n", global_failure ? "FAILED" : "OK");
+ printf("Overall result: %s : %d / %d (%g%%)\n", global_failure ? "FAILED" : "OK", global_passed, global_tests, pass_percentage);
}
if(report_time) {
string_array_free(tests_to_run);
}
- return 0;
+ return global_tests - global_passed;
}
+