summaryrefslogtreecommitdiffstats
path: root/test/stochastic_slow.c
blob: 1bab8c466d2be40b784bfec0b44e0aa18387fd79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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);
}