提交 c5238ada 编写于 作者: J jsalling

100% code coverage for Unity project

 Add test for failure count and UnityEnd return value
 Cover printing escape codes with length parameter
 Full statement coverage
上级 bff491c7
......@@ -1370,7 +1370,7 @@ void testNotEqualString4(void)
void testNotEqualStringLen4(void)
{
EXPECT_ABORT_BEGIN
TEST_ASSERT_EQUAL_STRING_LEN("bar\r", "bar\n", 4);
TEST_ASSERT_EQUAL_STRING_LEN("\r\x16", "bar\n", 4);
VERIFY_FAILS_END
}
......@@ -2260,6 +2260,19 @@ int putcharSpy(int c)
return c;
}
void testFailureCountIncrementsAndIsReturnedAtEnd(void)
{
Unity.CurrentTestFailed = 1;
startPutcharSpy(); // Suppress output
UnityConcludeTest();
TEST_ASSERT_EQUAL(1, Unity.TestFailures);
int failures = UnityEnd();
Unity.TestFailures--;
endPutcharSpy();
TEST_ASSERT_EQUAL(1, failures);
}
#define TEST_ASSERT_EQUAL_PRINT_NUMBERS(expected, actual) { \
startPutcharSpy(); UnityPrintNumber((actual)); endPutcharSpy(); \
TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册