#include #include #include "ts.h" bool ts_test_missing_bar_count( void ) { fp_t threshold = 0.5; fp_t const x[] = { 10, 10.1, 10.2, 10.1, 11, 11.1, 11.2, 11.3, 12.5, 12.6 }; fp_t const * const inp[1] = { x }; /* i=0: 0 * i=1: |10.1-10|=0.1 < 0.5, count=1 * i=2: |10.2-10.1|=0.1 < 0.5, count=2 * i=3: |10.1-10.2|=0.1 < 0.5, count=3 * i=4: |11-10.1|=0.9 >= 0.5, count=0 * i=5: |11.1-11|=0.1 < 0.5, count=1 * i=6: |11.2-11.1|=0.1 < 0.5, count=2 * i=7: |11.3-11.2|=0.1 < 0.5, count=3 * i=8: |12.5-11.3|=1.2 >= 0.5, count=0 * i=9: |12.6-12.5|=0.1 < 0.5, count=1 */ fp_t const e[] = { 0, 1, 2, 3, 0, 1, 2, 3, 0, 1 }; fp_t const * const exp[1] = { e }; return ts_test(ts_missing_bar_count, ts_missing_bar_count_offset, inp, exp, sizeof( x ) / sizeof( *x ), (ts_constant_t *)&threshold, &ts_missing_bar_count_p); }