diff options
Diffstat (limited to 'test/williams_r.c')
| -rw-r--r-- | test/williams_r.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/williams_r.c b/test/williams_r.c new file mode 100644 index 0000000..5d9f32f --- /dev/null +++ b/test/williams_r.c @@ -0,0 +1,22 @@ +#include <math.h> +#include <stddef.h> +#include "ts.h" + +bool ts_test_williams_r( void ) +{ + /* k=3, monotonic increase. C is always at the high end. */ + /* i=2: HH=14, LL=9, C=13 => -100*(14-13)/(14-9) = -20 */ + /* i=3: HH=15, LL=10, C=14 => -100*(15-14)/(15-10) = -20 */ + /* i=4: HH=16, LL=11, C=15 => -20 */ + fp_t const o[] = { 10, 11, 12, 13, 14, 15, 16, 17 }; + fp_t const h[] = { 12, 13, 14, 15, 16, 17, 18, 19 }; + fp_t const l[] = { 9, 10, 11, 12, 13, 14, 15, 16 }; + fp_t const c[] = { 11, 12, 13, 14, 15, 16, 17, 18 }; + + fp_t const * const x[] = { o, h, l, c }; + fp_t const e[] = { -20, -20, -20, -20, -20, -20 }; + fp_t const * const exp[1] = { e }; + + uint_t k = 3; + return ts_test(ts_williams_r, ts_williams_r_offset, x, exp, sizeof( o ) / sizeof( *o ), (ts_constant_t *)&k, &ts_williams_r_p); +} |