leaked < CRITICAL_LEAK_THRESHOLD ? "potential" : "critical",
before_free, after_free, leaked);
fflush(stdout);
- TEST_ASSERT(leaked < CRITICAL_LEAK_THRESHOLD); /* fail the test if it leaks too much */
+ TEST_ASSERT_MESSAGE(leaked < CRITICAL_LEAK_THRESHOLD, "The test leaked too much memory");
}
/* tearDown runs after every test */
/* some FreeRTOS stuff is cleaned up by idle task */
vTaskDelay(5);
+ /* We want the teardown to have this file in the printout if TEST_ASSERT fails */
+ const char *real_testfile = Unity.TestFile;
+ Unity.TestFile = __FILE__;
+
/* check if unit test has caused heap corruption in any heap */
- TEST_ASSERT( heap_caps_check_integrity(MALLOC_CAP_INVALID, true) );
+ TEST_ASSERT_MESSAGE( heap_caps_check_integrity(MALLOC_CAP_INVALID, true), "The test has corrupted the heap");
/* check for leaks */
size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
check_leak(before_free_8bit, after_free_8bit, "8BIT");
check_leak(before_free_32bit, after_free_32bit, "32BIT");
+
+ Unity.TestFile = real_testfile; // go back to the real filename
}
void unity_putc(int c)