Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/bin Modified Files: Ewl_Test2.h main.c Log Message: - unit tests don't use Ecore_List anymore just Ewl_Unit_Test *. makes it easier to do the initialization - and an example of how unit tests will be done to tests/ewl_text.c =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/bin/Ewl_Test2.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- Ewl_Test2.h 9 Mar 2006 05:45:14 -0000 1.2 +++ Ewl_Test2.h 9 Mar 2006 14:53:53 -0000 1.3 @@ -19,6 +19,13 @@ }; typedef enum Ewl_Test_Type Ewl_Test_Type; +typedef struct Ewl_Unit_Test Ewl_Unit_Test; +struct Ewl_Unit_Test +{ + const char *name; + int (*func)(char *buf, int len); +}; + typedef struct Ewl_Test Ewl_Test; struct Ewl_Test { @@ -29,14 +36,7 @@ void *handle; Ewl_Test_Type type; int (*func)(Ewl_Container *con); - Ecore_List *unit_tests; -}; - -typedef struct Ewl_Unit_Test Ewl_Unit_Test; -struct Ewl_Unit_Test -{ - const char *name; - int (*func)(char *buf, int len); + Ewl_Unit_Test *unit_tests; }; #endif =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/bin/main.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- main.c 9 Mar 2006 05:45:14 -0000 1.8 +++ main.c 9 Mar 2006 14:53:53 -0000 1.9 @@ -88,7 +88,9 @@ run_window_test(&test, MAIN_WIDTH, MAIN_HEIGHT); } - ewl_main(); + if (!unit_test) + ewl_main(); + return 0; } @@ -143,20 +145,20 @@ static void run_unit_tests(Ewl_Test *test) { - Ewl_Unit_Test *t; + int i; char buf[1024]; /* no unit tests, nothign to do */ if (!test->unit_tests) return; - ecore_list_goto_first(test->unit_tests); - while ((t = ecore_list_next(test->unit_tests))) + for (i = 0; test->unit_tests[i].func; i++) { int ret; - printf("Running %s: ", t->name); - ret = t->func(buf, sizeof(buf)); - printf("%s %s", (ret ? "passed" : "failed"), buf); + printf("Running %s: ", test->unit_tests[i].name); + ret = test->unit_tests[i].func(buf, sizeof(buf)); + printf("%s %s\n", (ret ? "passed" : "failed"), + (ret ? "" : buf)); buf[0] = '\0'; } } ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs