summaryrefslogtreecommitdiffstats
path: root/test/hurst_exponent.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/hurst_exponent.c')
-rw-r--r--test/hurst_exponent.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/hurst_exponent.c b/test/hurst_exponent.c
index ccf54c8..a200de9 100644
--- a/test/hurst_exponent.c
+++ b/test/hurst_exponent.c
@@ -1,3 +1,4 @@
+#include <math.h>
#include <stddef.h>
#include "ts.h"
@@ -6,6 +7,17 @@ bool ts_test_hurst_exponent( void )
uint_t const c[] = { 5 };
fp_t const x0[] = { 1,2,3,4,5,6,7,8,9,10 };
fp_t e0[10];
- ts_hurst_exponent((fp_t*[]){e0}, 1, (fp_t const *[]){x0}, 1, 10, (ts_constant_t *)&c);
+ int ret = ts_hurst_exponent((fp_t*[]){e0}, 1, (fp_t const *[]){x0}, 1, 10, (ts_constant_t *)&c);
+ if ( ret != 0 )
+ return false;
+
+ /* Verify output is finite (no NaN/Inf for valid input) */
+ for ( uint_t i = 0; i < 10; ++i )
+ {
+ fp_t v = e0[i];
+ if ( v != v ) return false;
+ if ( v == (fp_t)INFINITY || v == (fp_t)-INFINITY ) return false;
+ }
+
return true;
}