summaryrefslogtreecommitdiffstats
path: root/test/alligator.c
diff options
context:
space:
mode:
authorEthan Werner <mail@ethanwerner.com>2026-07-01 09:42:39 +0400
committerEthan Werner <mail@ethanwerner.com>2026-07-01 09:42:39 +0400
commit07e18043145f3d91c8ea7ec3ad41b3c905585277 (patch)
tree2bdeae46973f4bdfce263679a4008ac768011f28 /test/alligator.c
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
Diffstat (limited to 'test/alligator.c')
-rw-r--r--test/alligator.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/alligator.c b/test/alligator.c
new file mode 100644
index 0000000..0288d1a
--- /dev/null
+++ b/test/alligator.c
@@ -0,0 +1,21 @@
+#include <math.h>
+#include <stddef.h>
+#include "ts.h"
+
+bool ts_test_alligator( void )
+{
+ fp_t const x[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 };
+
+ fp_t const * const xp[1] = { x };
+
+ /* offset=12, y_n=12, comparison indices 12..23 */
+ /* Jaw (shift 8) writes at indices 8..19 → overlap 12..19 (8 values) */
+ /* Teeth (shift 5) writes at indices 5..21 → overlap 12..21 (10 values) */
+ /* Lips (shift 3) writes at indices 3..22 → overlap 12..22 (11 values) */
+ fp_t const ej[] = { 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 0, 0, 0, 0 };
+ fp_t const et[] = { 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, 0, 0 };
+ fp_t const el[] = { 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 0 };
+ fp_t const * const exp[3] = { ej, et, el };
+
+ return ts_test(ts_alligator, ts_alligator_offset, xp, exp, sizeof( x ) / sizeof( *x ), (ts_constant_t *)NULL, &ts_alligator_p);
+}