From 07e18043145f3d91c8ea7ec3ad41b3c905585277 Mon Sep 17 00:00:00 2001 From: Ethan Werner Date: Wed, 1 Jul 2026 09:42:39 +0400 Subject: initial commit: ts time series analysis library v0.1.0 - 354 financial and mathematical time-series indicators - Uniform C11 API with consistent function signatures - 349 passing tests with -Werror - Static and shared library builds - pkg-config integration - Python bindings - Fuzzing and sanitizer support - Security hardening flags --- test/dpo.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 test/dpo.c (limited to 'test/dpo.c') diff --git a/test/dpo.c b/test/dpo.c new file mode 100644 index 0000000..e6e4560 --- /dev/null +++ b/test/dpo.c @@ -0,0 +1,24 @@ +#include +#include +#include "ts.h" + +bool ts_test_dpo( void ) +{ + fp_t const x[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + + fp_t const * const inp[1] = { x }; + + /* k=4, offset=3 */ + /* SMA4: 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5 */ + /* DPO[3] = close[3] - SMA4[0] = 4 - 2.5 = 1.5 */ + /* DPO[4] = close[4] - SMA4[1] = 5 - 3.5 = 1.5 */ + /* ... all 1.5 */ + + fp_t const e[] = { 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5 }; + + fp_t const * const exp[1] = { e }; + + uint_t c_val = 4; + + return ts_test(ts_dpo, ts_dpo_offset, inp, exp, sizeof( x ) / sizeof( *x ), (ts_constant_t *)&c_val, &ts_dpo_p); +} -- cgit v1.3.1