From: Jean-Philippe Bruyère Date: Tue, 1 Mar 2022 15:55:30 +0000 (+0100) Subject: add -L option to tests, enable LOG in debug with loglevel in hexadecimal X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=99e8a561f43eba0b1550d88912581fb5e2e55a08;p=jp%2Fvkvg.git add -L option to tests, enable LOG in debug with loglevel in hexadecimal --- diff --git a/tests/common/test.c b/tests/common/test.c index c60e2c7..794e9bc 100644 --- a/tests/common/test.c +++ b/tests/common/test.c @@ -213,6 +213,11 @@ void _print_usage_and_exit () { printf("\t-vsync:\t\tEnable VSync, disabled by default.\n"); printf("\t-o:\t\tPerform test offscreen.\n"); printf("\t-w filepath:\twrite last image to png.\n"); +#ifdef DEBUG + printf("\t-L level:\tLog level in hexadecimal format (0xFF), 0 to disable.\n"); + printf("\t\t\tsee vkvg.h for possible values.\n"); +#endif + printf("\t-h:\t\tThis help message.\n"); printf("\n"); exit(-1); @@ -306,6 +311,12 @@ void _parse_args (int argc, char* argv[]) { if (argc -1 < ++i) _print_usage_and_exit(); saveToPng = argv[i]; +#ifdef DEBUG + }else if (strcmp (argv[i], "-L\0") == 0) { + if (argc -1 < ++i) + _print_usage_and_exit(); + sscanf(argv[i], "%x", &vkvg_log_level); +#endif }else _print_usage_and_exit(); } diff --git a/tests/dashes.c b/tests/dashes.c index 42a36a1..3fc0734 100644 --- a/tests/dashes.c +++ b/tests/dashes.c @@ -103,8 +103,6 @@ void curve () { int main(int argc, char *argv[]) { - //PERFORM_TEST(test, argc, argv); - //vkvg_log_level = VKVG_LOG_ERR|VKVG_LOG_DEBUG|VKVG_LOG_INFO|VKVG_LOG_INFO_PATH|VKVG_LOG_DBG_ARRAYS|VKVG_LOG_FULL; dashes_count = 2; dashes[0] = 0; dashes[1] = 10; diff --git a/tests/fill_non_zero.c b/tests/fill_non_zero.c index 4f5f51b..b70c7ee 100644 --- a/tests/fill_non_zero.c +++ b/tests/fill_non_zero.c @@ -25,7 +25,6 @@ void test(){ } int main(int argc, char *argv[]) { - //vkvg_log_level = VKVG_LOG_FULL; no_test_size = true; PERFORM_TEST (test, argc, argv); return 0; diff --git a/tests/perfs/random_rects.c b/tests/perfs/random_rects.c index fc26077..e5b1dc4 100644 --- a/tests/perfs/random_rects.c +++ b/tests/perfs/random_rects.c @@ -5,23 +5,21 @@ void drawRandomRect (VkvgContext ctx, float s) { float h = (float)test_height; randomize_color(ctx); - float x = truncf(w*rndf()); - float y = truncf(h*rndf()); + float x = truncf(w*rndf()); + float y = truncf(h*rndf()); - vkvg_rectangle(ctx, x, y, s, s); + vkvg_rectangle(ctx, x, y, s, s); } void fixedSizeRects(){ VkvgContext ctx = _initCtx (); for (uint32_t i=0; i