summaryrefslogtreecommitdiffstats
path: root/test/qstick.c
blob: daa13d20a41a202da871cfdb9a44106f5a9a9b28 (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_qstick( void )
{
    fp_t const x0[] = { 10, 10, 10, 20, 20, 30 };
    fp_t const x1[] = { 12, 13, 12, 22, 23, 33 };
    fp_t const x2[] = { 9,  9,  10, 19, 20, 29 };
    fp_t const x3[] = { 11, 12, 11, 21, 22, 31 };

    fp_t const * const x[] = { x0, x1, x2, x3 };

    uint_t k = 3;
    fp_t e[4];
    e[0] = ((11 - 10) + (12 - 10) + (11 - 10)) / 3.0;
    e[1] = e[0] + ((21 - 20) - (11 - 10)) / 3.0;
    e[2] = e[1] + ((22 - 20) - (12 - 10)) / 3.0;
    e[3] = e[2] + ((31 - 30) - (11 - 10)) / 3.0;

    fp_t const * const exp[1] = { e };

    return ts_test(ts_qstick, ts_qstick_offset, x, exp, sizeof( x0 ) / sizeof( *x0 ), (ts_constant_t *)&k, &ts_qstick_p);
}