1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-23 00:15:58 +01:00

Make UnityPrintFloat on by default

Remove UNITY_FLOAT_VERBOSE entirely, add option UNITY_EXCLUDE_FLOAT_PRINT
Remove some questionable float casts from doubles
Default to Round Ties to Even behavior, add option to Round Ties Away from Zero
This commit is contained in:
jsalling
2016-11-13 23:47:16 -06:00
parent 54fe786fae
commit 47f6a85b8c
4 changed files with 26 additions and 31 deletions

View File

@@ -2285,10 +2285,14 @@ void testFailureCountIncrementsAndIsReturnedAtEnd(void)
void testCstringsEscapeSequence(void)
{
#ifndef USING_OUTPUT_SPY
TEST_IGNORE();
#else
startPutcharSpy();
UnityPrint("\x16\x10");
endPutcharSpy();
TEST_ASSERT_EQUAL_STRING("\\x16\\x10", getBufferPutcharSpy());
#endif
}
#define TEST_ASSERT_EQUAL_PRINT_NUMBERS(expected, actual) { \
@@ -3228,16 +3232,14 @@ void testNotEqualFloatArraysLengthZero(void)
#endif
}
#ifdef UNITY_FLOAT_VERBOSE
#define TEST_ASSERT_EQUAL_PRINT_FLOATING(expected, actual) { \
startPutcharSpy(); UnityPrintFloat((actual)); endPutcharSpy(); \
TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \
}
#endif
void testFloatVerbosePrinting(void)
{
#ifdef UNITY_FLOAT_VERBOSE
#if !defined(UNITY_EXCLUDE_FLOAT_PRINT) && defined(USING_OUTPUT_SPY)
TEST_ASSERT_EQUAL_PRINT_FLOATING("0.0", 0.0f);
TEST_ASSERT_EQUAL_PRINT_FLOATING("0.000000...", 0.000000499f);
float smallest = 0.0000005f;