#include #include #include "ts.h" bool ts_test_synthetic_yield( void ) { /* k=3, prices: 100, 101, 102, 104, 106, 108, 110, 112, 114, 116 */ fp_t const x[] = { 100, 101, 102, 104, 106, 108, 110, 112, 114, 116 }; fp_t const * const inp[1] = { x }; /* i=3: (104-100)/100 * 252/3 * 100 = 336 */ /* i=4: (106-101)/101 * 84 * 100 = 42000/101 = 415.84158... */ /* i=5: (108-102)/102 * 84 * 100 = 50400/102 = 494.11765... */ /* i=6: (110-104)/104 * 84 * 100 = 50400/104 = 484.61538... */ /* i=7: (112-106)/106 * 84 * 100 = 50400/106 = 475.47170... */ /* i=8: (114-108)/108 * 84 * 100 = 50400/108 = 466.66667... */ /* i=9: (116-110)/110 * 84 * 100 = 50400/110 = 458.18182... */ fp_t const e[] = { 336, 415.84158, 494.11765, 484.61538, 475.47170, 466.66667, 458.18182 }; fp_t const * const exp[1] = { e }; uint_t k = 3; return ts_test(ts_synthetic_yield, ts_synthetic_yield_offset, inp, exp, sizeof( x ) / sizeof( *x ), (ts_constant_t *)&k, &ts_synthetic_yield_p); }