1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include <math.h>
#include <stddef.h>
#include "ts.h"
bool ts_test_rank( void )
{
/* k=3, data: 10, 20, 15, 25, 5, 30 */
/* i=2 (window [10,20,15]): current=15, <=: 10,15 => 2/3*100 = 66.667 */
/* i=3 (window [20,15,25]): current=25, <=: 20,15,25 => 3/3*100 = 100.0 */
/* i=4 (window [15,25,5]): current=5, <=: 5 => 1/3*100 = 33.333 */
/* i=5 (window [25,5,30]): current=30, <=: 25,5,30 => 3/3*100 = 100.0 */
fp_t const x[] = { 10, 20, 15, 25, 5, 30 };
fp_t const * const inp[1] = { x };
fp_t const e[] = { 66.66667, 100.0, 33.33333, 100.0 };
fp_t const * const exp[1] = { e };
uint_t k = 3;
return ts_test(ts_rank, ts_rank_offset, inp, exp, sizeof( x ) / sizeof( *x ), (ts_constant_t *)&k, &ts_rank_p);
}
|