diff --git a/tests/bloom_bytes/Makefile b/tests/bloom_bytes/Makefile index 1c4de258cae2839c37f9e1bcd5856b287c8bff69..6167da77d694b1841a527963befeea54066eb7d9 100644 --- a/tests/bloom_bytes/Makefile +++ b/tests/bloom_bytes/Makefile @@ -8,6 +8,8 @@ USEMODULE += bloom USEMODULE += random USEMODULE += xtimer +USEMODULE += fmt + DISABLE_MODULE += auto_init TEST_ON_CI_WHITELIST += all diff --git a/tests/bloom_bytes/main.c b/tests/bloom_bytes/main.c index 82288e28362f97443f690085b07b7aeb020ff8e9..64a6e78b539096699c97d96e0ad0ae8e3facd6f2 100644 --- a/tests/bloom_bytes/main.c +++ b/tests/bloom_bytes/main.c @@ -23,6 +23,7 @@ #include <inttypes.h> #include "xtimer.h" +#include "fmt.h" #include "hashes.h" #include "bloom.h" @@ -109,7 +110,14 @@ int main(void) printf("%d elements probably in the filter.\n", in); printf("%d elements not in the filter.\n", not_in); double false_positive_rate = (double) in / (double) lenA; - printf("%f false positive rate.\n", false_positive_rate); + /* Use 'fmt/print_float' to work on all platforms (atmega) + * Stdout should be flushed before to prevent garbled output. */ +#ifdef MODULE_NEWLIB + /* no fflush on msp430 */ + fflush(stdout); +#endif + print_float(false_positive_rate, 6); + puts(" false positive rate."); bloom_del(&bloom); printf("\nAll done!\n");