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/gator_oscillator.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 test/gator_oscillator.c (limited to 'test/gator_oscillator.c') diff --git a/test/gator_oscillator.c b/test/gator_oscillator.c new file mode 100644 index 0000000..13ae023 --- /dev/null +++ b/test/gator_oscillator.c @@ -0,0 +1,24 @@ +#include +#include +#include "ts.h" + +bool ts_test_gator_oscillator( void ) +{ + /* Linear prices: 0,1,2,...,24 */ + fp_t x[25] = { 0 }; + for ( uint_t i = 0; i < 25; ++i ) + x[i] = (fp_t)i; + + fp_t const * const inp[1] = { x }; + + /* At i=12: SMA(5) of [8..12] = 10, SMA(8) of [5..12] = 8.5, SMA(13) of [0..12] = 6 */ + /* Upper = |10 - 8.5| = 1.5, Lower = |6 - 8.5| = 2.5 */ + /* At i=13: SMA(5) of [9..13] = 11, SMA(8) of [6..13] = 9.5, SMA(13) of [1..13] = 7 */ + /* Upper = |11 - 9.5| = 1.5, Lower = |7 - 9.5| = 2.5 */ + /* Constant for linear series */ + fp_t const eu[] = { 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5 }; + fp_t const el[] = { 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5 }; + fp_t const * const exp[2] = { eu, el }; + + return ts_test(ts_gator_oscillator, ts_gator_oscillator_offset, inp, exp, 25, (ts_constant_t *)NULL, &ts_gator_oscillator_p); +} -- cgit v1.3.1