Skip to content

Commit 8823b3f

Browse files
apply some small changes
1 parent 4d8153f commit 8823b3f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

code/logic/fossil/test/testing.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ void fossil_test_run_all(fossil_test_env_t *env);
362362
#define _FOSSIL_TEST_SKIP(test_name, message) \
363363
test_name##_test_case.status = TEST_STATUS_SKIP; \
364364
test_name##_test_case.failure_message = message; \
365-
printf(FOSSIL_TEST_COLOR_YELLOW "SKIP: %s - %s\n" FOSSIL_TEST_COLOR_RESET, #test_name, message); \
365+
printf(FOSSIL_TEST_COLOR_YELLOW "SKIPPED: %s - %s\n" FOSSIL_TEST_COLOR_RESET, #test_name, message); \
366366

367367
/**
368368
* @brief Macro to define a test case.

code/logic/testing.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -586,13 +586,13 @@ void fossil_test_assert_internal(bool condition, const char *message, const char
586586
_ASSERT_COUNT++; // Increment the assertion count
587587

588588
if (!condition) {
589-
// Check if the current assertion is the same as the last one
590-
if (last_message && strcmp(last_message, message) == 0 &&
589+
// Check if the current assertion is the same or similar to the last one
590+
if (last_message && strstr(message, last_message) != NULL &&
591591
last_file && strcmp(last_file, file) == 0 &&
592592
last_line == line &&
593593
last_func && strcmp(last_func, func) == 0) {
594594
anomaly_count++;
595-
printf(FOSSIL_TEST_COLOR_YELLOW "Duplicate assertion detected: %s (%s:%d in %s) [Anomaly Count: %d]\n" FOSSIL_TEST_COLOR_RESET, message, file, line, func, anomaly_count);
595+
printf(FOSSIL_TEST_COLOR_YELLOW "Duplicate or similar assertion detected: %s (%s:%d in %s) [Anomaly Count: %d]\n" FOSSIL_TEST_COLOR_RESET, message, file, line, func, anomaly_count);
596596
} else {
597597
anomaly_count = 0; // Reset anomaly count for new assertion
598598
printf(FOSSIL_TEST_COLOR_RED "Assertion failed: %s (%s:%d in %s)\n" FOSSIL_TEST_COLOR_RESET, message, file, line, func);
@@ -635,14 +635,14 @@ void fossil_test_run_case(test_case_t *test_case, fossil_test_env_t *env) {
635635
}
636636
} else {
637637
test_case->status = TEST_STATUS_FAIL;
638-
printf(FOSSIL_TEST_COLOR_RED "FAIL: " FOSSIL_TEST_COLOR_BLUE " %s\n", test_case->name);
638+
printf(FOSSIL_TEST_COLOR_RED "FAILED: " FOSSIL_TEST_COLOR_BLUE " %s\n", test_case->name);
639639
printf("Failure Message: %s\n" FOSSIL_TEST_COLOR_RESET, test_case->failure_message);
640640
}
641641
test_case->execution_time = (double)(clock() - test_start_time) / CLOCKS_PER_SEC;
642642

643643
// Check if the test case is empty
644644
if (_ASSERT_COUNT == 0) {
645-
printf(FOSSIL_TEST_COLOR_YELLOW "WARNING: " FOSSIL_TEST_COLOR_BLUE " %s contains no assertions\n" FOSSIL_TEST_COLOR_RESET, test_case->name);
645+
printf(FOSSIL_TEST_COLOR_YELLOW "WARNING: %s contains no assertions\n" FOSSIL_TEST_COLOR_RESET, test_case->name);
646646
}
647647

648648
// Run teardown
@@ -651,7 +651,7 @@ void fossil_test_run_case(test_case_t *test_case, fossil_test_env_t *env) {
651651
// Log result
652652
if (test_case->status == TEST_STATUS_PASS) {
653653
if (env->options.show_info) {
654-
printf(FOSSIL_TEST_COLOR_GREEN "PASS: " FOSSIL_TEST_COLOR_BLUE " %s (%.3f seconds)\n" FOSSIL_TEST_COLOR_RESET, test_case->name, test_case->execution_time);
654+
printf(FOSSIL_TEST_COLOR_GREEN "PASSED: " FOSSIL_TEST_COLOR_BLUE " %s (%.3f seconds)\n" FOSSIL_TEST_COLOR_RESET, test_case->name, test_case->execution_time);
655655
}
656656
} else if (test_case->status == TEST_STATUS_FAIL) {
657657
env->fail_count++;

0 commit comments

Comments
 (0)