From 326c8feb9e6ee0a5a21cd77b87ea9849c40698b7 Mon Sep 17 00:00:00 2001 From: qgymib Date: Mon, 6 Mar 2023 15:33:25 +0800 Subject: [PATCH] print version --- include/cutest.h | 2 +- src/cutest.c | 21 ++++++++++++++------- test/unit/case/feature_failure_print.c | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/include/cutest.h b/include/cutest.h index faee0523..0ec9e640 100644 --- a/include/cutest.h +++ b/include/cutest.h @@ -115,7 +115,7 @@ extern "C" { /** * @brief Development version. */ -#define CUTEST_VERSION_PREREL 1 +#define CUTEST_VERSION_PREREL 2 /** * @brief Ensure the api is exposed as C function. diff --git a/src/cutest.c b/src/cutest.c index a91cba38..072cd126 100644 --- a/src/cutest.c +++ b/src/cutest.c @@ -3157,20 +3157,27 @@ static void _cutest_cleanup(void) static void _cutest_show_information(void) { +#if CUTEST_VERSION_PREREL cutest_porting_fprintf(g_test_ctx.out, - "[ $PARAM ] --test_shuffle=%d\n", (int)g_test_ctx.mask.shuffle); + "[ $VERSION ] %d.%d.%d-dev%d\n", CUTEST_VERSION_MAJOR, CUTEST_VERSION_MINOR, CUTEST_VERSION_PATCH, CUTEST_VERSION_PREREL); +#else + cutest_porting_fprintf(g_test_ctx.out, + "[ $VERSION ] %d.%d.%d\n", CUTEST_VERSION_MAJOR, CUTEST_VERSION_MINOR, CUTEST_VERSION_PATCH); +#endif + cutest_porting_fprintf(g_test_ctx.out, + "[ $PARAME. ] --test_shuffle=%d\n", (int)g_test_ctx.mask.shuffle); cutest_porting_fprintf(g_test_ctx.out, - "[ $PARAM ] --test_random_seed=%lu\n", g_test_ctx.shuffle_seed); + "[ $PARAME. ] --test_random_seed=%lu\n", g_test_ctx.shuffle_seed); cutest_porting_fprintf(g_test_ctx.out, - "[ $PARAM ] --test_also_run_disabled_tests=%d\n", (int)g_test_ctx.mask.also_run_disabled_tests); + "[ $PARAME. ] --test_also_run_disabled_tests=%d\n", (int)g_test_ctx.mask.also_run_disabled_tests); cutest_porting_fprintf(g_test_ctx.out, - "[ $PARAM ] --test_filter=%s\n", g_test_ctx.filter.pattern.ptr != NULL ? g_test_ctx.filter.pattern.ptr : ""); + "[ $PARAME. ] --test_filter=%s\n", g_test_ctx.filter.pattern.ptr != NULL ? g_test_ctx.filter.pattern.ptr : ""); cutest_porting_fprintf(g_test_ctx.out, - "[ $PARAM ] --test_repeat=%lu\n", g_test_ctx.counter.repeat.repeat); + "[ $PARAME. ] --test_repeat=%lu\n", g_test_ctx.counter.repeat.repeat); cutest_porting_fprintf(g_test_ctx.out, - "[ $PARAM ] --test_break_on_failure=%d\n", (int)g_test_ctx.mask.break_on_failure); + "[ $PARAME. ] --test_break_on_failure=%d\n", (int)g_test_ctx.mask.break_on_failure); cutest_porting_fprintf(g_test_ctx.out, - "[ $PARAM ] --test_print_time=%d\n", (int)!g_test_ctx.mask.no_print_time); + "[ $PARAME. ] --test_print_time=%d\n", (int)!g_test_ctx.mask.no_print_time); cutest_porting_fprintf(g_test_ctx.out, "[==========] total %u test%s registered.\n", (unsigned)g_test_nature.case_table.size, diff --git a/test/unit/case/feature_failure_print.c b/test/unit/case/feature_failure_print.c index 5ef36377..980ee97a 100644 --- a/test/unit/case/feature_failure_print.c +++ b/test/unit/case/feature_failure_print.c @@ -19,7 +19,7 @@ DEFINE_TEST(failure_print, c_string) { string_matrix_t* matrix = string_matrix_create_from_file(_TEST.out, "\n"); - const char* ret = string_matrix_access(matrix, 12, 0); + const char* ret = string_matrix_access(matrix, 13, 0); TEST_PORTING_ASSERT(strcmp(ret, "0 is not 1") == 0); string_matrix_destroy(matrix);