ruuvi.drivers.c ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
Loading...
Searching...
No Matches
ruuvi_driver_test.c
Go to the documentation of this file.
2#if RUUVI_RUN_TESTS
4#include "ruuvi_driver_test.h"
8#include <math.h>
9#include <stdint.h>
10#include <stdio.h>
11#include <string.h>
12
13bool ri_expect_close (const float expect, const int8_t precision,
14 const float check)
15{
16 if (!isfinite (expect) || !isfinite (check)) { return false; }
17
18 const float max_delta = pow (10, precision);
19 float delta = expect - check;
20
21 if (delta < 0) { delta = 0 - delta; } // absolute value
22
23 return max_delta > delta;
24}
25
26#endif
Header to enable and disable module compilation.
Ruuvi error codes and error check function.
Functions for testing drivers.