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/missing_bar_count.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/missing_bar_count.c (limited to 'test/missing_bar_count.c') diff --git a/test/missing_bar_count.c b/test/missing_bar_count.c new file mode 100644 index 0000000..e15e634 --- /dev/null +++ b/test/missing_bar_count.c @@ -0,0 +1,28 @@ +#include +#include +#include "ts.h" + +bool ts_test_missing_bar_count( void ) +{ + fp_t threshold = 0.5; + + fp_t const x[] = { 10, 10.1, 10.2, 10.1, 11, 11.1, 11.2, 11.3, 12.5, 12.6 }; + + fp_t const * const inp[1] = { x }; + + /* i=0: 0 + * i=1: |10.1-10|=0.1 < 0.5, count=1 + * i=2: |10.2-10.1|=0.1 < 0.5, count=2 + * i=3: |10.1-10.2|=0.1 < 0.5, count=3 + * i=4: |11-10.1|=0.9 >= 0.5, count=0 + * i=5: |11.1-11|=0.1 < 0.5, count=1 + * i=6: |11.2-11.1|=0.1 < 0.5, count=2 + * i=7: |11.3-11.2|=0.1 < 0.5, count=3 + * i=8: |12.5-11.3|=1.2 >= 0.5, count=0 + * i=9: |12.6-12.5|=0.1 < 0.5, count=1 + */ + fp_t const e[] = { 0, 1, 2, 3, 0, 1, 2, 3, 0, 1 }; + fp_t const * const exp[1] = { e }; + + return ts_test(ts_missing_bar_count, ts_missing_bar_count_offset, inp, exp, sizeof( x ) / sizeof( *x ), (ts_constant_t *)&threshold, &ts_missing_bar_count_p); +} -- cgit v1.3.1