summaryrefslogtreecommitdiffstats
path: root/test/std_error.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/std_error.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/std_error.c')
-rw-r--r--test/std_error.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/std_error.c b/test/std_error.c
new file mode 100644
index 0000000..1bc050e
--- /dev/null
+++ b/test/std_error.c
@@ -0,0 +1,17 @@
+#include <math.h>
+#include <stddef.h>
+#include "ts.h"
+
+bool ts_test_std_error( void )
+{
+ fp_t const x[] = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 };
+ fp_t const * const inp[1] = { x };
+
+ /* k=3, SD=sqrt(2/3)=0.81650 for all windows */
+ /* StdError = SD/sqrt(3) = 0.81650/1.73205 = 0.47140 */
+ fp_t const e[] = { 0.47140, 0.47140, 0.47140, 0.47140, 0.47140, 0.47140, 0.47140, 0.47140 };
+ fp_t const * const exp[1] = { e };
+
+ uint_t k = 3;
+ return ts_test(ts_std_error, ts_std_error_offset, inp, exp, sizeof( x ) / sizeof( *x ), (ts_constant_t *)&k, &ts_std_error_p);
+}