summaryrefslogtreecommitdiffstats
path: root/test/qstick.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/qstick.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/qstick.c')
-rw-r--r--test/qstick.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/qstick.c b/test/qstick.c
new file mode 100644
index 0000000..daa13d2
--- /dev/null
+++ b/test/qstick.c
@@ -0,0 +1,24 @@
+#include <math.h>
+#include <stddef.h>
+#include "ts.h"
+
+bool ts_test_qstick( void )
+{
+ fp_t const x0[] = { 10, 10, 10, 20, 20, 30 };
+ fp_t const x1[] = { 12, 13, 12, 22, 23, 33 };
+ fp_t const x2[] = { 9, 9, 10, 19, 20, 29 };
+ fp_t const x3[] = { 11, 12, 11, 21, 22, 31 };
+
+ fp_t const * const x[] = { x0, x1, x2, x3 };
+
+ uint_t k = 3;
+ fp_t e[4];
+ e[0] = ((11 - 10) + (12 - 10) + (11 - 10)) / 3.0;
+ e[1] = e[0] + ((21 - 20) - (11 - 10)) / 3.0;
+ e[2] = e[1] + ((22 - 20) - (12 - 10)) / 3.0;
+ e[3] = e[2] + ((31 - 30) - (11 - 10)) / 3.0;
+
+ fp_t const * const exp[1] = { e };
+
+ return ts_test(ts_qstick, ts_qstick_offset, x, exp, sizeof( x0 ) / sizeof( *x0 ), (ts_constant_t *)&k, &ts_qstick_p);
+}