mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
416c048737
- Define test_utils_interactive_sync as DEFAULT_MODULE in Makefile.tests_common - For tests disabling autoinit, add test_utils_interactive_sync to main - Add DISABLE_MODULE += test_utils_interactive_sync for tests requiring sudo, `tests/shell`, `tests/minimal` and `tests/stdin` - Add shell_commands to tests/periph_wdt and tests/struct_tm_utility to pull `r` and `s` commands - Remove includes and usage in `tests/main.c` for tests that where already using test_utils_interactive_sync
58 lines
1.1 KiB
C
58 lines
1.1 KiB
C
/*
|
|
* Copyright (C) 2013 INRIA
|
|
* 2017 Freie Universität Berlin
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
* directory for more details.
|
|
*/
|
|
|
|
/**
|
|
* @ingroup tests
|
|
* @{
|
|
*
|
|
* @file
|
|
* @brief Float test application
|
|
*
|
|
* @author Oliver Hahm <oliver.hahm@inria.fr>
|
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
|
*
|
|
* @}
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <math.h>
|
|
|
|
#include "test_utils/interactive_sync.h"
|
|
|
|
#include "board.h"
|
|
|
|
/* as default we run the test 100k times */
|
|
#ifndef TEST_ITER
|
|
#define TEST_ITER (100000UL)
|
|
#endif
|
|
|
|
#define STEP (0.1)
|
|
|
|
int main(void)
|
|
{
|
|
test_utils_interactive_sync();
|
|
|
|
double x = 1234567.0 / 1024.0;
|
|
|
|
puts("Testing floating point arithmetic...\n");
|
|
|
|
for (unsigned long i = 0; i < TEST_ITER; i++) {
|
|
x += STEP;
|
|
double z = (x - floor(x));
|
|
if (z >= 1.0) {
|
|
puts("[FAILED]");
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
puts("[SUCCESS]");
|
|
|
|
return 0;
|
|
}
|