diff options
Diffstat (limited to 'test/acceleration_bands.c')
| -rw-r--r-- | test/acceleration_bands.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/acceleration_bands.c b/test/acceleration_bands.c new file mode 100644 index 0000000..5911e8b --- /dev/null +++ b/test/acceleration_bands.c @@ -0,0 +1,28 @@ +#include <math.h> +#include <stddef.h> +#include "ts.h" + +bool ts_test_acceleration_bands( void ) +{ + fp_t const o[] = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }; + fp_t const h[] = { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 }; + fp_t const l[] = { 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }; + fp_t const cp[] = { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; + + fp_t const * const x[] = { o, h, l, cp }; + + /* k=3, offset=2, y_n=8 */ + /* Rolling HH3: 12,13,14,15,16,17,18,19,20,21 */ + /* Rolling LL3: 9,9,9,10,11,12,13,14,15,16 */ + /* TP = (H+L+C)/3: 10.667,11.667,12.667,13.667,14.667,15.667,16.667,17.667,18.667,19.667 */ + /* SMA3(HH3): 13,14,15,16,17,18,19,20 */ + /* SMA3(TP): 11.667,12.667,13.667,14.667,15.667,16.667,17.667,18.667 */ + /* SMA3(LL3): 9,9.333,10,11,12,13,14,15 */ + fp_t const eu[] = { 13, 14, 15, 16, 17, 18, 19, 20 }; + fp_t const em[] = { 11.66667, 12.66667, 13.66667, 14.66667, 15.66667, 16.66667, 17.66667, 18.66667 }; + fp_t const el[] = { 9, 9.33333, 10, 11, 12, 13, 14, 15 }; + fp_t const * const exp[3] = { eu, em, el }; + + uint_t k = 3; + return ts_test(ts_acceleration_bands, ts_acceleration_bands_offset, x, exp, sizeof( o ) / sizeof( *o ), (ts_constant_t *)&k, &ts_acceleration_bands_p); +} |