diff options
| author | Ethan Werner <mail@ethanwerner.com> | 2026-07-01 09:42:39 +0400 |
|---|---|---|
| committer | Ethan Werner <mail@ethanwerner.com> | 2026-07-01 09:42:39 +0400 |
| commit | 07e18043145f3d91c8ea7ec3ad41b3c905585277 (patch) | |
| tree | 2bdeae46973f4bdfce263679a4008ac768011f28 /test/mass_index.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/mass_index.c')
| -rw-r--r-- | test/mass_index.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/mass_index.c b/test/mass_index.c new file mode 100644 index 0000000..2075b59 --- /dev/null +++ b/test/mass_index.c @@ -0,0 +1,26 @@ +#include <math.h> +#include <stddef.h> +#include "ts.h" + +bool ts_test_mass_index( void ) +{ + /* Use constant H-L so ratio converges to 1, sum = 26 */ + fp_t o[30] = { 0 }; + fp_t h[30]; + fp_t l[30]; + fp_t c[30] = { 0 }; + fp_t v[30] = { 0 }; + + for ( uint_t i = 0; i < 30; ++i ) + { + h[i] = 11; + l[i] = 9; + } + + fp_t const * const x[] = { o, h, l, c, v }; + + fp_t const e[4] = { 26.0, 26.0, 26.0, 26.0 }; + fp_t const * const exp[1] = { e }; + + return ts_test(ts_mass_index, ts_mass_index_offset, x, exp, 30, (ts_constant_t *)NULL, &ts_mass_index_p); +} |