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/mesa_sine_wave.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/mesa_sine_wave.c (limited to 'test/mesa_sine_wave.c') diff --git a/test/mesa_sine_wave.c b/test/mesa_sine_wave.c new file mode 100644 index 0000000..598de80 --- /dev/null +++ b/test/mesa_sine_wave.c @@ -0,0 +1,22 @@ +#include +#include +#include "ts.h" + +bool ts_test_mesa_sine_wave( void ) +{ + /* k=3 */ + fp_t const x[] = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }; + + fp_t const * const inp[1] = { x }; + + /* SMA(3): 11, 12, 13, 14, 15, 16, 17, 18 */ + /* ROC: 13-11=2, 14-12=2, 15-13=2, 16-14=2, 17-15=2, 18-16=2, 19-18=2 */ + /* EMA(5) of constant 2 converges to 2, clamped to 1 */ + /* All sines = 1, all leads = 0 */ + fp_t const es[] = { 1, 1, 1, 1, 1, 1, 1 }; + fp_t const el[] = { 0, 0, 0, 0, 0, 0, 0 }; + fp_t const * const exp[2] = { es, el }; + + uint_t k = 3; + return ts_test(ts_mesa_sine_wave, ts_mesa_sine_wave_offset, inp, exp, sizeof( x ) / sizeof( *x ), (ts_constant_t *)&k, &ts_mesa_sine_wave_p); +} -- cgit v1.3.1