MCPcopy Create free account
hub / github.com/ThrowTheSwitch/Unity / printFloatValue

Function printFloatValue

test/tests/test_unity_floats.c:1293–1309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1291#if defined(UNITY_TEST_ALL_FLOATS_PRINT_OK) && defined(USING_OUTPUT_SPY)
1292#ifdef UNITY_INCLUDE_DOUBLE
1293static void printFloatValue(float f)
1294{
1295 char expected[18];
1296
1297 startPutcharSpy();
1298 UnityPrintFloat(f);
1299
1300 sprintf(expected, "%.9g", f);
1301 /* We print all NaN's as "nan", not "-nan" */
1302 if (strcmp(expected, "-nan") == 0) strcpy(expected, "nan");
1303
1304 if (strcmp(expected, getBufferPutcharSpy()))
1305 {
1306 /* Fail with diagnostic printing */
1307 TEST_ASSERT_EQUAL_PRINT_FLOATING(expected, f);
1308 }
1309}
1310#else
1311static void printFloatValue(float f)
1312{

Callers 1

Calls 3

startPutcharSpyFunction · 0.85
UnityPrintFloatFunction · 0.85
getBufferPutcharSpyFunction · 0.85

Tested by

no test coverage detected