Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/pcut/src/report/tap.c

    r9b20126 r9eb1ff5  
    4242static int test_counter;
    4343
     44/** Counter of all failures. */
     45static int failed_test_counter;
     46
    4447/** Counter for tests in a current suite. */
    4548static int tests_in_suite;
     
    5558        int tests_total = pcut_count_tests(all_items);
    5659        test_counter = 0;
     60        failed_test_counter = 0;
    5761
    5862        printf("1..%d\n", tests_total);
     
    7579 */
    7680static void tap_suite_done(pcut_item_t *suite) {
    77         printf("#> Finished suite %s (failed %d of %d).\n",
    78                         suite->name, failed_tests_in_suite, tests_in_suite);
     81        if (failed_tests_in_suite == 0) {
     82                printf("#> Finished suite %s (passed).\n",
     83                                suite->name);
     84        } else {
     85                printf("#> Finished suite %s (failed %d of %d).\n",
     86                                suite->name, failed_tests_in_suite, tests_in_suite);
     87        }
    7988}
    8089
     
    129138        const char *fail_error_str = NULL;
    130139
    131         if (outcome != TEST_OUTCOME_PASS) {
     140        if (outcome != PCUT_OUTCOME_PASS) {
    132141                failed_tests_in_suite++;
     142                failed_test_counter++;
    133143        }
    134144
    135145        switch (outcome) {
    136         case TEST_OUTCOME_PASS:
     146        case PCUT_OUTCOME_PASS:
    137147                status_str = "ok";
    138148                fail_error_str = "";
    139149                break;
    140         case TEST_OUTCOME_FAIL:
     150        case PCUT_OUTCOME_FAIL:
    141151                status_str = "not ok";
    142152                fail_error_str = " failed";
    143153                break;
    144         case TEST_OUTCOME_ERROR:
     154        default:
    145155                status_str = "not ok";
    146156                fail_error_str = " aborted";
    147                 break;
    148         default:
    149                 /* Shall not get here. */
    150157                break;
    151158        }
     
    160167/** Report testing done. */
    161168static void tap_done(void) {
     169        if (failed_test_counter == 0) {
     170                printf("#> Done: all tests passed.\n");
     171        } else {
     172                printf("#> Done: %d of %d tests failed.\n", failed_test_counter, test_counter);
     173        }
    162174}
    163175
Note: See TracChangeset for help on using the changeset viewer.