mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-08-20 18:19:56 +00:00
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
This commit is contained in:
+2
-2
@@ -235,8 +235,8 @@ void tearDown(void);
|
|||||||
//Structs and Strings
|
//Structs and Strings
|
||||||
#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, (message))
|
#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, (message))
|
||||||
#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING((expected), (actual), __LINE__, (message))
|
#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING((expected), (actual), __LINE__, (message))
|
||||||
#define TEST_ASSERT_EQUAL_STRING_LEN_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_STRING_LEN((expected), (actual), (len), __LINE__, (message))
|
#define TEST_ASSERT_EQUAL_STRING_LEN_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_STRING_LEN((expected), (actual), (len), __LINE__, (message))
|
||||||
#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY((expected), (actual), (len), __LINE__, (message))
|
#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY((expected), (actual), (len), __LINE__, (message))
|
||||||
|
|
||||||
//Arrays
|
//Arrays
|
||||||
#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
|||||||
+14
-1
@@ -1370,7 +1370,7 @@ void testNotEqualString4(void)
|
|||||||
void testNotEqualStringLen4(void)
|
void testNotEqualStringLen4(void)
|
||||||
{
|
{
|
||||||
EXPECT_ABORT_BEGIN
|
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
|
VERIFY_FAILS_END
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2260,6 +2260,19 @@ int putcharSpy(int c)
|
|||||||
return 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) { \
|
#define TEST_ASSERT_EQUAL_PRINT_NUMBERS(expected, actual) { \
|
||||||
startPutcharSpy(); UnityPrintNumber((actual)); endPutcharSpy(); \
|
startPutcharSpy(); UnityPrintNumber((actual)); endPutcharSpy(); \
|
||||||
TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \
|
TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \
|
||||||
|
|||||||
Reference in New Issue
Block a user