mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-23 00:15:58 +01:00
Converting RUN_TEST() from a macro to a function significantly reduces the size of the compiled binary. On amd64, the largest test runner in the test suite (testsample_DefaultsThroughCommandLine_runner.o) was reduced from 3.4 kB to 2.4 kB (stripped).
37 lines
950 B
Plaintext
37 lines
950 B
Plaintext
/*=======Test Runner Used To Run Each Test=====*/
|
|
static void run_test(UnityTestFunction func, const char* name, int line_num)
|
|
{
|
|
Unity.CurrentTestName = name;
|
|
Unity.CurrentTestLineNumber = line_num;
|
|
#ifdef UNITY_USE_COMMAND_LINE_ARGS
|
|
if (!UnityTestMatches())
|
|
return;
|
|
#endif
|
|
Unity.NumberOfTests++;
|
|
UNITY_CLR_DETAILS();
|
|
UNITY_EXEC_TIME_START();
|
|
CMock_Init();
|
|
if (TEST_PROTECT())
|
|
{
|
|
<% if @options[:plugins].include?(:cexception) %>
|
|
CEXCEPTION_T e;
|
|
Try {
|
|
<% end %>
|
|
<%= @options[:setup_name] %>();
|
|
func();
|
|
<% if @options[:plugins].include?(:cexception) %>
|
|
} Catch(e) {
|
|
TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!");
|
|
}
|
|
<% end %>
|
|
}
|
|
if (TEST_PROTECT())
|
|
{
|
|
<%= @options[:teardown_name] %>();
|
|
CMock_Verify();
|
|
}
|
|
CMock_Destroy();
|
|
UNITY_EXEC_TIME_STOP();
|
|
UnityConcludeTest();
|
|
}
|