diff options
Diffstat (limited to 'test/stochastic_slow.c')
| -rw-r--r-- | test/stochastic_slow.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/stochastic_slow.c b/test/stochastic_slow.c new file mode 100644 index 0000000..1bab8c4 --- /dev/null +++ b/test/stochastic_slow.c @@ -0,0 +1,24 @@ +#include <math.h> +#include <stddef.h> +#include "ts.h" + +bool ts_test_stochastic_slow( void ) +{ + /* k=3, offset=3*k-3=6. Monotonic increase => all %K=80 (HH-LL=3, C-LL=2) => all smoothed = 80 */ + fp_t const o[] = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 }; + fp_t const h[] = { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }; + fp_t const l[] = { 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 }; + fp_t const c[] = { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; + + fp_t const * const x[] = { o, h, l, c }; + + /* offset=6, so y_n = 15-6 = 9 values per output */ + /* slow %K and %D all = 80 after initial fill */ + fp_t const ek[] = { 80, 80, 80, 80, 80, 80, 80, 80, 80 }; + fp_t const ed[] = { 80, 80, 80, 80, 80, 80, 80, 80, 80 }; + + fp_t const * const exp[2] = { ek, ed }; + + uint_t k = 3; + return ts_test(ts_stochastic_slow, ts_stochastic_slow_offset, x, exp, sizeof( o ) / sizeof( *o ), (ts_constant_t *)&k, &ts_stochastic_slow_p); +} |