| 1369 | #endif |
| 1370 | |
| 1371 | void testFloatPrintingRandomSamples(void) |
| 1372 | { |
| 1373 | #if !defined(UNITY_TEST_ALL_FLOATS_PRINT_OK) || !defined(USING_OUTPUT_SPY) |
| 1374 | TEST_IGNORE(); |
| 1375 | #else |
| 1376 | union { float f_value; uint32_t int_value; } u; |
| 1377 | |
| 1378 | /* These values are not covered by the MINSTD generator */ |
| 1379 | u.int_value = 0x00000000; printFloatValue(u.f_value); |
| 1380 | u.int_value = 0x80000000; printFloatValue(u.f_value); |
| 1381 | u.int_value = 0x7fffffff; printFloatValue(u.f_value); |
| 1382 | u.int_value = 0xffffffff; printFloatValue(u.f_value); |
| 1383 | |
| 1384 | uint32_t a = 1; |
| 1385 | for(int num_tested = 0; num_tested < 1000000; num_tested++) |
| 1386 | { |
| 1387 | /* MINSTD pseudo-random number generator */ |
| 1388 | a = (uint32_t)(((uint64_t)a * 48271u) % 2147483647u); |
| 1389 | |
| 1390 | /* MINSTD does not set the highest bit; test both possibilities */ |
| 1391 | u.int_value = a; printFloatValue(u.f_value); |
| 1392 | u.int_value = a | 0x80000000; printFloatValue(u.f_value); |
| 1393 | } |
| 1394 | #endif |
| 1395 | } |
nothing calls this directly
no test coverage detected