diff --git a/tests/rng/Makefile b/tests/rng/Makefile index ad8461b476cb007fa13f6e656594bc181aa12680..3c75d2f5e3a515bba53a4b47c9fcc4f565de091a 100644 --- a/tests/rng/Makefile +++ b/tests/rng/Makefile @@ -8,7 +8,6 @@ BOARD_INSUFFICIENT_MEMORY += arduino-duemilanove arduino-uno # USEMODULE += prng_minstd USEMODULE += fmt -USEMODULE += printf_float USEMODULE += random USEMODULE += shell USEMODULE += xtimer diff --git a/tests/rng/test.c b/tests/rng/test.c index d73722e4e811bc6c5ef00d095c901ffbf49836cc..c09414b52c4f50498dfef67893466f4cc9201396 100644 --- a/tests/rng/test.c +++ b/tests/rng/test.c @@ -154,7 +154,7 @@ void test_distributions(uint32_t samples) /* count bits */ for (int i = 0; i < 32; i++) { - if (value & (1 << i)) { + if (value & (UINT32_C(1) << i)) { distributions[i]++; } } @@ -382,7 +382,15 @@ void test_entropy(uint32_t samples) } /* print results */ - printf("Calculated %02f bits of entropy from %" PRIu32 " samples.\n", (double) entropy, samples); + /* Use 'fmt/print_float' to work on all platforms (atmega) + * Stdout should be flushed before to prevent garbled output. */ + printf("Calculated "); +#ifdef MODULE_NEWLIB + /* no fflush on msp430 */ + fflush(stdout); +#endif + print_float(entropy, 6); + printf(" bits of entropy from %" PRIu32 " samples.\n", samples); } void cb_speed_timeout(void *arg)