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/kvo.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 test/kvo.c (limited to 'test/kvo.c') diff --git a/test/kvo.c b/test/kvo.c new file mode 100644 index 0000000..c0f489f --- /dev/null +++ b/test/kvo.c @@ -0,0 +1,40 @@ +#include +#include +#include "ts.h" + +bool ts_test_kvo( void ) +{ + uint_t k1 = 3; + uint_t k2 = 3; + + fp_t const o[] = { 10, 11, 10, 12, 11, 13, 12, 14, 13, 15, 14, 16, 15, 17, 16 }; + fp_t const h[] = { 12, 13, 12, 14, 13, 15, 14, 16, 15, 17, 16, 18, 17, 19, 18 }; + fp_t const l[] = { 8, 9, 8, 10, 9, 11, 10, 12, 11, 13, 12, 14, 13, 15, 14 }; + fp_t const c[] = { 11, 10, 12, 11, 13, 12, 14, 13, 15, 14, 16, 15, 17, 16, 18 }; + fp_t const v[] = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500 }; + + fp_t const * const x[] = { o, h, l, c, v }; + + fp_t e_kvo[5] = { + 1.0, + -0.044715, + 0.542893, + -0.323870, + 0.444411 + }; + + fp_t e_sig[5] = { + 1.0, + 0.477642, + 0.510268, + 0.093199, + 0.268805 + }; + + fp_t const * const exp[2] = { e_kvo, e_sig }; + + typedef struct { uint_t k1; fp_t k2; } c_t; + c_t cv = { .k1 = k1, .k2 = (fp_t)k2 }; + + return ts_test(ts_kvo, ts_kvo_offset, x, exp, 15, (ts_constant_t *)&cv, &ts_kvo_p); +} -- cgit v1.3.1