MCPcopy Create free account
hub / github.com/DaveGamble/cJSON / testFloatPrintingRandomSamples

Function testFloatPrintingRandomSamples

tests/unity/test/tests/testunity.c:4557–4581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4555#endif
4556
4557void testFloatPrintingRandomSamples(void)
4558{
4559#if !defined(UNITY_TEST_ALL_FLOATS_PRINT_OK) || !defined(USING_OUTPUT_SPY)
4560 TEST_IGNORE();
4561#else
4562 union { float f_value; uint32_t int_value; } u;
4563
4564 /* These values are not covered by the MINSTD generator */
4565 u.int_value = 0x00000000; printFloatValue(u.f_value);
4566 u.int_value = 0x80000000; printFloatValue(u.f_value);
4567 u.int_value = 0x7fffffff; printFloatValue(u.f_value);
4568 u.int_value = 0xffffffff; printFloatValue(u.f_value);
4569
4570 uint32_t a = 1;
4571 for(int num_tested = 0; num_tested < 1000000; num_tested++)
4572 {
4573 /* MINSTD pseudo-random number generator */
4574 a = (uint32_t)(((uint64_t)a * 48271u) % 2147483647u);
4575
4576 /* MINSTD does not set the highest bit; test both possibilities */
4577 u.int_value = a; printFloatValue(u.f_value);
4578 u.int_value = a | 0x80000000; printFloatValue(u.f_value);
4579 }
4580#endif
4581}
4582
4583// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES DOUBLE SUPPORT ==================
4584

Callers

nothing calls this directly

Calls 1

printFloatValueFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…