Files
wickra/examples/c/golden_test.c
T
kingchencandGitHub 4f708d410d test: golden-pin the four de-duplicated indicators across all bindings (#305)
* test: golden-pin the four de-duplicated indicators across all C-ABI bindings

Extend gen_golden to emit reference fixtures for AdOscillator (ADOSC),
IntradayIntensity, AwesomeOscillatorHistogram and AverageDrawdown, and replay
them through the Go / C# / Java / R golden harnesses so their corrected
definitions stay bit-identical to the Rust core in every binding. Go suite
verified locally (gcc 13 + cgo): all 9 golden tests pass; C#/Java/R use the
same fixtures and harness pattern (CI-verified). First step of extending the
golden coverage beyond the seven archetype representatives.

* test: golden-pin the scalar-output tranche (308 indicators) against Rust

Extend gen_golden with a generated emit_scalar that writes reference fixtures
for every single-f64-output indicator (scalar / candle / pairwise input) using
valid constructor params, and add a manifest-driven generic Python golden
replay that reconstructs each by its native name and checks it bit-for-bit
against the Rust output. 308 indicators now value-tied to the Rust core in
Python (pytest: 308/308). Takes golden coverage from the 7 archetype
representatives to 308+ of the catalogue.

22 scalar indicators with non-default constructor constraints are skipped by
gen_golden for now (logged), as are non-f64-output ones; multi-output, exotic
inputs and the per-indicator arg arities of the C-ABI/Node replays follow.
Generated + verified locally with the full toolchain.

* test: golden-pin the multi-output tranche (70 indicators) in Python

Add a generated emit_multi to gen_golden (per-indicator Output-field access,
one CSV column per field) and a manifest-driven generic Python replay that
checks every field of each multi-output indicator against the Rust reference.
70 multi-output indicators now value-tied to Rust in Python; combined with the
scalar tranche, 378 indicators are golden-pinned. 8 multi with non-default
param constraints and 5 with non-f64 Output fields (Option/Vec/i64) are
deferred. pytest green.

* test(golden): add 30 constraint-tuned indicators to scalar/multi golden suite

Emit golden fixtures for 22 scalar-output and 8 multi-output indicators
whose constructors need non-default parameters (Alma, Jma, Psar, T3, Mama,
DoubleBollinger, ZigZag, ...). All 408 fixtures replay bit-for-bit through
the Python binding.

* test(golden): cover 36 missed scalar/multi indicators

Add 26 single-output (LinearRegression family, HT cycle, Candle
volatility estimators, DrawdownDuration) and 10 multi-output
(BollingerBands, MACD/MACDEXT/MACDFIX, Camarilla, VWAP bands, ...)
indicators to the golden suite. 444 fixtures replay bit-for-bit
through the Python binding.

* test(golden): cover 50 exotic-input indicators

Add deterministic synthetic feeders for the DerivativesTick (17),
CrossSection (15), Trade (8), TradeQuote (3) and OrderBook (7)
families, derived from the shared OHLCV input series in both
gen_golden and a new Python replay harness (test_golden_exotic).
All 494 fixtures replay bit-for-bit through the Python binding.

* test(golden): complete 514-indicator golden coverage

Add the final tranches: 3 mixed multi-output indicators (Ichimoku,
WilliamsFractals, LeadLagCrossCorrelation), 6 histogram profiles
(time/volume seasonality + TPO/volume price profiles), 10 alt-chart
bar builders and the footprint. Every one of the 514 distinct
indicators now has a Rust-generated g_<Canonical>.csv fixture and a
generic Python replay (scalar/multi/exotic/profile/bars), all passing
bit-for-bit.

* test(golden): add generic Node replay for all 514 indicators

A manifest-driven node:test harness reconstructs every indicator by its
native class, feeds the same synthetic stream derived from the shared
golden input, and checks output bit-for-bit against the Rust reference
fixtures (scalar/multi/exotic/profile/bars). node_manifest.json is
generated from index.d.ts plus the Python-side manifests. 514/514 pass.

* test(golden): add generated Go replay for all 514 indicators

golden_all_test.go (generated by gen_golden_test.py) reconstructs every
Go indicator, feeds the shared synthetic stream and checks output
bit-for-bit against the Rust reference fixtures. A reflection-based
comparator flattens multi-output structs, profiles and bar slices so one
path covers all archetypes. This is the first C-ABI binding verified
across the full catalogue. 514/514 pass.

* test(golden): add generated C# replay for all 514 indicators

GoldenAllTests.g.cs (generated by gen_golden_test.py) reconstructs every
C# indicator, feeds the shared synthetic stream and checks output
bit-for-bit against the Rust reference fixtures via a reflection-based
flatten covering scalar/multi/profile/bar archetypes. 514/514 pass.

Also add the '#nullable enable' directive the compiler requires to the
generated Indicators.g.cs, clearing the four CS8669 warnings on the
nullable double[] profile return types.

* fix(java): marshal C ABI bool params correctly; add 514 golden replay

The Java FFM binding marshalled the cross-section state flags (newHigh,
newLow, aboveMa, onBuySignal) as JAVA_DOUBLE arrays, but the C ABI takes
them as const bool* (one byte each), so the native side read the low byte
of each 8-byte double and saw every flag as false. Add WickraNative.
boolSegment and use it across the 15 cross-section indicators. Also pass
the MacdExt MaType arguments as byte to match the uint8_t downcall
descriptor (was int, throwing WrongMethodTypeException).

Add GoldenAllTest.java (generated by gen_golden_test.py): a reflection
runner replaying all 514 indicators against the Rust reference fixtures.
The bugs above were found by this test; 514/514 now pass.

* fix(r): marshal C ABI bool flags correctly; add 514 golden replay

The R wrapper passed the cross-section state flags as (bool *)REAL(x),
reinterpreting the 8-byte doubles as 1-byte bools so the native side read
every flag as false. Add wk_bool_vec to convert each flag vector into a
real C bool buffer and use it for all 15 cross-section update wrappers.

Add test-golden-all.R + generated golden_specs.R: a reflective runner
replaying all 514 indicators against the Rust reference fixtures. The bug
above was found by this test; verified 514/514 pass locally.

* test(golden): add WASM replay for all 514 indicators

A manifest-driven node:test harness loads the nodejs-target wasm-pack
build, reconstructs every indicator by its JS class, feeds the shared
synthetic stream and checks output bit-for-bit against the Rust
reference fixtures. wasm_manifest.json is generated from the wasm .d.ts
plus the shared manifests; a recursive flattener covers scalar, multi
(Reflect objects), profile and bar shapes. 514/514 pass locally
(wasm-pack build --target nodejs, then node --test).

* test(golden): add C and C++ replay for all 514 indicators

golden_test.c (generated by gen_golden_test.py) drives every indicator
through the C ABI (wickra.h) and checks output bit-for-bit against the
Rust reference fixtures. golden_test.cpp #includes the same source so the
identical runner is compiled and run under both gcc (C) and g++ (C++) via
the CMake targets golden_test / golden_test_cpp — proving the extern "C"
header is consumable from each language. Both 514/514 (verified via ctest).

* test(golden): gofmt the generated Go golden replay

* test(golden): make the Node fixture reader CRLF-safe and pin fixtures to LF
2026-06-15 04:48:51 +02:00

9673 lines
423 KiB
C

/* Generated by gen_golden_test.py. DO NOT EDIT.
*
* Value-parity for the whole 514-indicator catalogue through the Wickra C ABI.
* The same source compiles as C (gcc) and C++ (g++) since wickra.h is extern "C".
* Each indicator replays the shared golden input and is checked bit-for-bit
* against the Rust reference fixtures testdata/golden/g_<Canonical>.csv. */
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "wickra.h"
#define NANV (nan(""))
#define MAXROWS 512
#define MAXCOLS 256
static double IN[MAXROWS][8];
static int N_INPUT = 0;
static int EXPLEN[MAXROWS];
static const char *GDIR = NULL;
static double parse_cell(const char *s) {
if (strcmp(s, "nan") == 0) return NANV;
if (strcmp(s, "inf") == 0) return INFINITY;
if (strcmp(s, "-inf") == 0) return -INFINITY;
return atof(s);
}
static int split_line(char *line, double *out, int max) {
int n = 0;
char *p = line;
while (*p && n < max) {
char *comma = strchr(p, ',');
if (comma) *comma = '\0';
out[n++] = parse_cell(p);
if (!comma) break;
p = comma + 1;
}
return n;
}
static FILE *open_fixture(const char *name) {
char path[1024];
snprintf(path, sizeof(path), "%s/%s.csv", GDIR, name);
return fopen(path, "r");
}
static void load_input(void) {
FILE *f = open_fixture("input");
if (!f) { fprintf(stderr, "cannot open input.csv in %s\n", GDIR); exit(2); }
char line[8192];
int first = 1;
while (fgets(line, sizeof(line), f)) {
line[strcspn(line, "\r\n")] = '\0';
if (first) { first = 0; continue; }
if (line[0] == '\0') continue;
N_INPUT += (split_line(line, IN[N_INPUT], 8) > 0);
}
fclose(f);
}
/* Read a fixture, keeping blank rows (a candle on which no bar closed). */
static int read_fixture(const char *name, double ***outp) {
FILE *f = open_fixture(name);
if (!f) { fprintf(stderr, "cannot open %s.csv\n", name); exit(2); }
double **rows = (double **)malloc(sizeof(double *) * MAXROWS);
int n = 0, first = 1;
char line[8192];
while (fgets(line, sizeof(line), f) && n < MAXROWS) {
line[strcspn(line, "\r\n")] = '\0';
if (first) { first = 0; continue; }
double *vals = (double *)malloc(sizeof(double) * MAXCOLS);
int c = (line[0] == '\0') ? 0 : split_line(line, vals, MAXCOLS);
EXPLEN[n] = c;
rows[n++] = vals;
}
fclose(f);
*outp = rows;
return n;
}
static void free_fixture(double **rows, int n) {
for (int i = 0; i < n; i++) free(rows[i]);
free(rows);
}
static int close_to(double g, double w) {
if (isnan(w)) return isnan(g);
if (isinf(w)) return isinf(g) && ((g > 0) == (w > 0));
double tol = 1e-6 * (fabs(w) > 1.0 ? fabs(w) : 1.0);
return fabs(g - w) <= tol;
}
static int cmp_row(const char *name, int i, const double *want, int wn, const double *got, int gn) {
if (wn != gn) {
printf("FAIL %s row %d: arity %d vs %d\n", name, i, gn, wn);
return 1;
}
for (int k = 0; k < wn; k++) {
if (!close_to(got[k], want[k])) {
printf("FAIL %s row %d col %d: got %g want %g\n", name, i, k, got[k], want[k]);
return 1;
}
}
return 0;
}
static int check_AbandonedBaby(void) {
struct AbandonedBaby *h = wickra_abandoned_baby_new();
if (!h) { printf("FAIL AbandonedBaby: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AbandonedBaby", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_abandoned_baby_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("AbandonedBaby", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_abandoned_baby_free(h);
return fails;
}
static int check_Abcd(void) {
struct Abcd *h = wickra_abcd_new();
if (!h) { printf("FAIL Abcd: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Abcd", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_abcd_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Abcd", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_abcd_free(h);
return fails;
}
static int check_AbsoluteBreadthIndex(void) {
struct AbsoluteBreadthIndex *h = wickra_absolute_breadth_index_new();
if (!h) { printf("FAIL AbsoluteBreadthIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AbsoluteBreadthIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5];
for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); }
got[gn++] = wickra_absolute_breadth_index_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i);
fails += cmp_row("AbsoluteBreadthIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_absolute_breadth_index_free(h);
return fails;
}
static int check_AccelerationBands(void) {
struct AccelerationBands *h = wickra_acceleration_bands_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL AccelerationBands: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AccelerationBands", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraAccelerationBandsOutput out;
if (wickra_acceleration_bands_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.upper;
got[gn++] = out.middle;
got[gn++] = out.lower;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("AccelerationBands", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_acceleration_bands_free(h);
return fails;
}
static int check_AcceleratorOscillator(void) {
struct AcceleratorOscillator *h = wickra_accelerator_oscillator_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14);
if (!h) { printf("FAIL AcceleratorOscillator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AcceleratorOscillator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_accelerator_oscillator_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("AcceleratorOscillator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_accelerator_oscillator_free(h);
return fails;
}
static int check_AdOscillator(void) {
struct AdOscillator *h = wickra_ad_oscillator_new();
if (!h) { printf("FAIL AdOscillator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AdOscillator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_ad_oscillator_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("AdOscillator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ad_oscillator_free(h);
return fails;
}
static int check_AdVolumeLine(void) {
struct AdVolumeLine *h = wickra_ad_volume_line_new();
if (!h) { printf("FAIL AdVolumeLine: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AdVolumeLine", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5];
for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); }
got[gn++] = wickra_ad_volume_line_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i);
fails += cmp_row("AdVolumeLine", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ad_volume_line_free(h);
return fails;
}
static int check_AdaptiveCci(void) {
struct AdaptiveCci *h = wickra_adaptive_cci_new((uintptr_t)14);
if (!h) { printf("FAIL AdaptiveCci: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AdaptiveCci", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_adaptive_cci_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("AdaptiveCci", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_adaptive_cci_free(h);
return fails;
}
static int check_AdaptiveCycle(void) {
struct AdaptiveCycle *h = wickra_adaptive_cycle_new();
if (!h) { printf("FAIL AdaptiveCycle: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AdaptiveCycle", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_adaptive_cycle_update(h, c);
fails += cmp_row("AdaptiveCycle", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_adaptive_cycle_free(h);
return fails;
}
static int check_AdaptiveLaguerreFilter(void) {
struct AdaptiveLaguerreFilter *h = wickra_adaptive_laguerre_filter_new((uintptr_t)20);
if (!h) { printf("FAIL AdaptiveLaguerreFilter: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AdaptiveLaguerreFilter", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_adaptive_laguerre_filter_update(h, c);
fails += cmp_row("AdaptiveLaguerreFilter", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_adaptive_laguerre_filter_free(h);
return fails;
}
static int check_AdaptiveRsi(void) {
struct AdaptiveRsi *h = wickra_adaptive_rsi_new((uintptr_t)14);
if (!h) { printf("FAIL AdaptiveRsi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AdaptiveRsi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_adaptive_rsi_update(h, c);
fails += cmp_row("AdaptiveRsi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_adaptive_rsi_free(h);
return fails;
}
static int check_Adl(void) {
struct Adl *h = wickra_adl_new();
if (!h) { printf("FAIL Adl: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Adl", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_adl_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Adl", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_adl_free(h);
return fails;
}
static int check_AdvanceBlock(void) {
struct AdvanceBlock *h = wickra_advance_block_new();
if (!h) { printf("FAIL AdvanceBlock: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AdvanceBlock", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_advance_block_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("AdvanceBlock", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_advance_block_free(h);
return fails;
}
static int check_AdvanceDecline(void) {
struct AdvanceDecline *h = wickra_advance_decline_new();
if (!h) { printf("FAIL AdvanceDecline: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AdvanceDecline", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5];
for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); }
got[gn++] = wickra_advance_decline_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i);
fails += cmp_row("AdvanceDecline", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_advance_decline_free(h);
return fails;
}
static int check_AdvanceDeclineRatio(void) {
struct AdvanceDeclineRatio *h = wickra_advance_decline_ratio_new();
if (!h) { printf("FAIL AdvanceDeclineRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AdvanceDeclineRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5];
for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); }
got[gn++] = wickra_advance_decline_ratio_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i);
fails += cmp_row("AdvanceDeclineRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_advance_decline_ratio_free(h);
return fails;
}
static int check_Adx(void) {
struct Adx *h = wickra_adx_new((uintptr_t)14);
if (!h) { printf("FAIL Adx: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Adx", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraAdxOutput out;
if (wickra_adx_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.plus_di;
got[gn++] = out.minus_di;
got[gn++] = out.adx;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("Adx", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_adx_free(h);
return fails;
}
static int check_Adxr(void) {
struct Adxr *h = wickra_adxr_new((uintptr_t)14);
if (!h) { printf("FAIL Adxr: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Adxr", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_adxr_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Adxr", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_adxr_free(h);
return fails;
}
static int check_Alligator(void) {
struct Alligator *h = wickra_alligator_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14);
if (!h) { printf("FAIL Alligator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Alligator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraAlligatorOutput out;
if (wickra_alligator_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.jaw;
got[gn++] = out.teeth;
got[gn++] = out.lips;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("Alligator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_alligator_free(h);
return fails;
}
static int check_Alma(void) {
struct Alma *h = wickra_alma_new((uintptr_t)9, 0.85, 6.0);
if (!h) { printf("FAIL Alma: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Alma", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_alma_update(h, c);
fails += cmp_row("Alma", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_alma_free(h);
return fails;
}
static int check_Alpha(void) {
struct Alpha *h = wickra_alpha_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL Alpha: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Alpha", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_alpha_update(h, c, o);
fails += cmp_row("Alpha", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_alpha_free(h);
return fails;
}
static int check_AmihudIlliquidity(void) {
struct AmihudIlliquidity *h = wickra_amihud_illiquidity_new((uintptr_t)20);
if (!h) { printf("FAIL AmihudIlliquidity: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AmihudIlliquidity", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_amihud_illiquidity_update(h, c, v, c >= o, (int64_t)i);
fails += cmp_row("AmihudIlliquidity", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_amihud_illiquidity_free(h);
return fails;
}
static int check_AnchoredRsi(void) {
struct AnchoredRsi *h = wickra_anchored_rsi_new();
if (!h) { printf("FAIL AnchoredRsi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AnchoredRsi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_anchored_rsi_update(h, c);
fails += cmp_row("AnchoredRsi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_anchored_rsi_free(h);
return fails;
}
static int check_AnchoredVwap(void) {
struct AnchoredVwap *h = wickra_anchored_vwap_new();
if (!h) { printf("FAIL AnchoredVwap: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AnchoredVwap", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_anchored_vwap_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("AnchoredVwap", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_anchored_vwap_free(h);
return fails;
}
static int check_AndrewsPitchfork(void) {
struct AndrewsPitchfork *h = wickra_andrews_pitchfork_new((uintptr_t)14);
if (!h) { printf("FAIL AndrewsPitchfork: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AndrewsPitchfork", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraAndrewsPitchforkOutput out;
if (wickra_andrews_pitchfork_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.median;
got[gn++] = out.upper;
got[gn++] = out.lower;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("AndrewsPitchfork", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_andrews_pitchfork_free(h);
return fails;
}
static int check_Apo(void) {
struct Apo *h = wickra_apo_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL Apo: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Apo", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_apo_update(h, c);
fails += cmp_row("Apo", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_apo_free(h);
return fails;
}
static int check_Aroon(void) {
struct Aroon *h = wickra_aroon_new((uintptr_t)14);
if (!h) { printf("FAIL Aroon: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Aroon", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraAroonOutput out;
if (wickra_aroon_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.up;
got[gn++] = out.down;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("Aroon", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_aroon_free(h);
return fails;
}
static int check_AroonOscillator(void) {
struct AroonOscillator *h = wickra_aroon_oscillator_new((uintptr_t)14);
if (!h) { printf("FAIL AroonOscillator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AroonOscillator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_aroon_oscillator_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("AroonOscillator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_aroon_oscillator_free(h);
return fails;
}
static int check_Atr(void) {
struct Atr *h = wickra_atr_new((uintptr_t)14);
if (!h) { printf("FAIL Atr: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Atr", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_atr_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Atr", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_atr_free(h);
return fails;
}
static int check_AtrBands(void) {
struct AtrBands *h = wickra_atr_bands_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL AtrBands: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AtrBands", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraAtrBandsOutput out;
if (wickra_atr_bands_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.upper;
got[gn++] = out.middle;
got[gn++] = out.lower;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("AtrBands", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_atr_bands_free(h);
return fails;
}
static int check_AtrRatchet(void) {
struct AtrRatchet *h = wickra_atr_ratchet_new((uintptr_t)14, 2.0, 0.5);
if (!h) { printf("FAIL AtrRatchet: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AtrRatchet", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraAtrRatchetOutput out;
if (wickra_atr_ratchet_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.value;
got[gn++] = out.direction;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("AtrRatchet", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_atr_ratchet_free(h);
return fails;
}
static int check_AtrTrailingStop(void) {
struct AtrTrailingStop *h = wickra_atr_trailing_stop_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL AtrTrailingStop: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AtrTrailingStop", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_atr_trailing_stop_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("AtrTrailingStop", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_atr_trailing_stop_free(h);
return fails;
}
static int check_AutoFib(void) {
struct AutoFib *h = wickra_auto_fib_new();
if (!h) { printf("FAIL AutoFib: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AutoFib", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraAutoFibOutput out;
if (wickra_auto_fib_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.level_0;
got[gn++] = out.level_236;
got[gn++] = out.level_382;
got[gn++] = out.level_500;
got[gn++] = out.level_618;
got[gn++] = out.level_786;
got[gn++] = out.level_1000;
} else {
for (int z = 0; z < 7; z++) got[gn++] = NANV;
}
fails += cmp_row("AutoFib", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_auto_fib_free(h);
return fails;
}
static int check_Autocorrelation(void) {
struct Autocorrelation *h = wickra_autocorrelation_new((uintptr_t)10, (uintptr_t)1);
if (!h) { printf("FAIL Autocorrelation: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Autocorrelation", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_autocorrelation_update(h, c);
fails += cmp_row("Autocorrelation", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_autocorrelation_free(h);
return fails;
}
static int check_AutocorrelationPeriodogram(void) {
struct AutocorrelationPeriodogram *h = wickra_autocorrelation_periodogram_new((uintptr_t)10, (uintptr_t)48);
if (!h) { printf("FAIL AutocorrelationPeriodogram: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AutocorrelationPeriodogram", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_autocorrelation_periodogram_update(h, c);
fails += cmp_row("AutocorrelationPeriodogram", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_autocorrelation_periodogram_free(h);
return fails;
}
static int check_AverageDailyRange(void) {
struct AverageDailyRange *h = wickra_average_daily_range_new((uintptr_t)14, (int32_t)0);
if (!h) { printf("FAIL AverageDailyRange: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AverageDailyRange", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_average_daily_range_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("AverageDailyRange", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_average_daily_range_free(h);
return fails;
}
static int check_AverageDrawdown(void) {
struct AverageDrawdown *h = wickra_average_drawdown_new((uintptr_t)14);
if (!h) { printf("FAIL AverageDrawdown: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AverageDrawdown", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_average_drawdown_update(h, c);
fails += cmp_row("AverageDrawdown", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_average_drawdown_free(h);
return fails;
}
static int check_AvgPrice(void) {
struct AvgPrice *h = wickra_avg_price_new();
if (!h) { printf("FAIL AvgPrice: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AvgPrice", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_avg_price_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("AvgPrice", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_avg_price_free(h);
return fails;
}
static int check_AwesomeOscillator(void) {
struct AwesomeOscillator *h = wickra_awesome_oscillator_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL AwesomeOscillator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AwesomeOscillator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_awesome_oscillator_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("AwesomeOscillator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_awesome_oscillator_free(h);
return fails;
}
static int check_AwesomeOscillatorHistogram(void) {
struct AwesomeOscillatorHistogram *h = wickra_awesome_oscillator_histogram_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14);
if (!h) { printf("FAIL AwesomeOscillatorHistogram: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_AwesomeOscillatorHistogram", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_awesome_oscillator_histogram_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("AwesomeOscillatorHistogram", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_awesome_oscillator_histogram_free(h);
return fails;
}
static int check_BalanceOfPower(void) {
struct BalanceOfPower *h = wickra_balance_of_power_new();
if (!h) { printf("FAIL BalanceOfPower: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_BalanceOfPower", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_balance_of_power_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("BalanceOfPower", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_balance_of_power_free(h);
return fails;
}
static int check_BandpassFilter(void) {
struct BandpassFilter *h = wickra_bandpass_filter_new((uintptr_t)20, 0.3);
if (!h) { printf("FAIL BandpassFilter: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_BandpassFilter", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_bandpass_filter_update(h, c);
fails += cmp_row("BandpassFilter", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_bandpass_filter_free(h);
return fails;
}
static int check_Bat(void) {
struct Bat *h = wickra_bat_new();
if (!h) { printf("FAIL Bat: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Bat", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_bat_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Bat", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_bat_free(h);
return fails;
}
static int check_BeltHold(void) {
struct BeltHold *h = wickra_belt_hold_new();
if (!h) { printf("FAIL BeltHold: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_BeltHold", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_belt_hold_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("BeltHold", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_belt_hold_free(h);
return fails;
}
static int check_Beta(void) {
struct Beta *h = wickra_beta_new((uintptr_t)14);
if (!h) { printf("FAIL Beta: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Beta", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_beta_update(h, c, o);
fails += cmp_row("Beta", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_beta_free(h);
return fails;
}
static int check_BetaNeutralSpread(void) {
struct BetaNeutralSpread *h = wickra_beta_neutral_spread_new((uintptr_t)14);
if (!h) { printf("FAIL BetaNeutralSpread: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_BetaNeutralSpread", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_beta_neutral_spread_update(h, c, o);
fails += cmp_row("BetaNeutralSpread", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_beta_neutral_spread_free(h);
return fails;
}
static int check_BetterVolume(void) {
struct BetterVolume *h = wickra_better_volume_new((uintptr_t)14);
if (!h) { printf("FAIL BetterVolume: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_BetterVolume", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_better_volume_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("BetterVolume", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_better_volume_free(h);
return fails;
}
static int check_BipowerVariation(void) {
struct BipowerVariation *h = wickra_bipower_variation_new((uintptr_t)14);
if (!h) { printf("FAIL BipowerVariation: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_BipowerVariation", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_bipower_variation_update(h, c);
fails += cmp_row("BipowerVariation", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_bipower_variation_free(h);
return fails;
}
static int check_BodySizePct(void) {
struct BodySizePct *h = wickra_body_size_pct_new();
if (!h) { printf("FAIL BodySizePct: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_BodySizePct", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_body_size_pct_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("BodySizePct", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_body_size_pct_free(h);
return fails;
}
static int check_BollingerBands(void) {
struct BollingerBands *h = wickra_bollinger_bands_new((uintptr_t)20, 2.0);
if (!h) { printf("FAIL BollingerBands: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_BollingerBands", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraBollingerOutput out;
if (wickra_bollinger_bands_update(h, c, &out)) {
got[gn++] = out.upper;
got[gn++] = out.middle;
got[gn++] = out.lower;
got[gn++] = out.stddev;
} else {
for (int z = 0; z < 4; z++) got[gn++] = NANV;
}
fails += cmp_row("BollingerBands", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_bollinger_bands_free(h);
return fails;
}
static int check_BollingerBandwidth(void) {
struct BollingerBandwidth *h = wickra_bollinger_bandwidth_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL BollingerBandwidth: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_BollingerBandwidth", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_bollinger_bandwidth_update(h, c);
fails += cmp_row("BollingerBandwidth", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_bollinger_bandwidth_free(h);
return fails;
}
static int check_BomarBands(void) {
struct BomarBands *h = wickra_bomar_bands_new((uintptr_t)4, 0.85);
if (!h) { printf("FAIL BomarBands: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_BomarBands", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraBomarBandsOutput out;
if (wickra_bomar_bands_update(h, c, &out)) {
got[gn++] = out.upper;
got[gn++] = out.middle;
got[gn++] = out.lower;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("BomarBands", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_bomar_bands_free(h);
return fails;
}
static int check_BreadthThrust(void) {
struct BreadthThrust *h = wickra_breadth_thrust_new((uintptr_t)10);
if (!h) { printf("FAIL BreadthThrust: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_BreadthThrust", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5];
for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); }
got[gn++] = wickra_breadth_thrust_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i);
fails += cmp_row("BreadthThrust", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_breadth_thrust_free(h);
return fails;
}
static int check_Breakaway(void) {
struct Breakaway *h = wickra_breakaway_new();
if (!h) { printf("FAIL Breakaway: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Breakaway", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_breakaway_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Breakaway", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_breakaway_free(h);
return fails;
}
static int check_BullishPercentIndex(void) {
struct BullishPercentIndex *h = wickra_bullish_percent_index_new();
if (!h) { printf("FAIL BullishPercentIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_BullishPercentIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5];
for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); }
got[gn++] = wickra_bullish_percent_index_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i);
fails += cmp_row("BullishPercentIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_bullish_percent_index_free(h);
return fails;
}
static int check_BurkeRatio(void) {
struct BurkeRatio *h = wickra_burke_ratio_new((uintptr_t)14);
if (!h) { printf("FAIL BurkeRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_BurkeRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_burke_ratio_update(h, c);
fails += cmp_row("BurkeRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_burke_ratio_free(h);
return fails;
}
static int check_Butterfly(void) {
struct Butterfly *h = wickra_butterfly_new();
if (!h) { printf("FAIL Butterfly: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Butterfly", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_butterfly_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Butterfly", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_butterfly_free(h);
return fails;
}
static int check_CalendarSpread(void) {
struct CalendarSpread *h = wickra_calendar_spread_new();
if (!h) { printf("FAIL CalendarSpread: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_CalendarSpread", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo;
got[gn++] = wickra_calendar_spread_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i);
fails += cmp_row("CalendarSpread", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_calendar_spread_free(h);
return fails;
}
static int check_CalmarRatio(void) {
struct CalmarRatio *h = wickra_calmar_ratio_new((uintptr_t)14);
if (!h) { printf("FAIL CalmarRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_CalmarRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_calmar_ratio_update(h, c);
fails += cmp_row("CalmarRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_calmar_ratio_free(h);
return fails;
}
static int check_Camarilla(void) {
struct Camarilla *h = wickra_camarilla_new();
if (!h) { printf("FAIL Camarilla: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Camarilla", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraCamarillaPivotsOutput out;
if (wickra_camarilla_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.pp;
got[gn++] = out.r1;
got[gn++] = out.r2;
got[gn++] = out.r3;
got[gn++] = out.r4;
got[gn++] = out.s1;
got[gn++] = out.s2;
got[gn++] = out.s3;
got[gn++] = out.s4;
} else {
for (int z = 0; z < 9; z++) got[gn++] = NANV;
}
fails += cmp_row("Camarilla", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_camarilla_free(h);
return fails;
}
static int check_CandleVolume(void) {
struct CandleVolume *h = wickra_candle_volume_new((uintptr_t)14);
if (!h) { printf("FAIL CandleVolume: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_CandleVolume", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraCandleVolumeOutput out;
if (wickra_candle_volume_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.body;
got[gn++] = out.width;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("CandleVolume", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_candle_volume_free(h);
return fails;
}
static int check_Cci(void) {
struct Cci *h = wickra_cci_new((uintptr_t)14);
if (!h) { printf("FAIL Cci: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Cci", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_cci_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Cci", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_cci_free(h);
return fails;
}
static int check_CenterOfGravity(void) {
struct CenterOfGravity *h = wickra_center_of_gravity_new((uintptr_t)14);
if (!h) { printf("FAIL CenterOfGravity: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_CenterOfGravity", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_center_of_gravity_update(h, c);
fails += cmp_row("CenterOfGravity", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_center_of_gravity_free(h);
return fails;
}
static int check_CentralPivotRange(void) {
struct CentralPivotRange *h = wickra_central_pivot_range_new();
if (!h) { printf("FAIL CentralPivotRange: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_CentralPivotRange", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraCentralPivotRangeOutput out;
if (wickra_central_pivot_range_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.pivot;
got[gn++] = out.tc;
got[gn++] = out.bc;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("CentralPivotRange", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_central_pivot_range_free(h);
return fails;
}
static int check_Cfo(void) {
struct Cfo *h = wickra_cfo_new((uintptr_t)14);
if (!h) { printf("FAIL Cfo: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Cfo", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_cfo_update(h, c);
fails += cmp_row("Cfo", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_cfo_free(h);
return fails;
}
static int check_ChaikinMoneyFlow(void) {
struct ChaikinMoneyFlow *h = wickra_chaikin_money_flow_new((uintptr_t)20);
if (!h) { printf("FAIL ChaikinMoneyFlow: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ChaikinMoneyFlow", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_chaikin_money_flow_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ChaikinMoneyFlow", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_chaikin_money_flow_free(h);
return fails;
}
static int check_ChaikinOscillator(void) {
struct ChaikinOscillator *h = wickra_chaikin_oscillator_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL ChaikinOscillator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ChaikinOscillator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_chaikin_oscillator_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ChaikinOscillator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_chaikin_oscillator_free(h);
return fails;
}
static int check_ChaikinVolatility(void) {
struct ChaikinVolatility *h = wickra_chaikin_volatility_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL ChaikinVolatility: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ChaikinVolatility", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_chaikin_volatility_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ChaikinVolatility", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_chaikin_volatility_free(h);
return fails;
}
static int check_ChandeKrollStop(void) {
struct ChandeKrollStop *h = wickra_chande_kroll_stop_new((uintptr_t)3, 2.0, (uintptr_t)7);
if (!h) { printf("FAIL ChandeKrollStop: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ChandeKrollStop", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraChandeKrollStopOutput out;
if (wickra_chande_kroll_stop_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.stop_long;
got[gn++] = out.stop_short;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("ChandeKrollStop", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_chande_kroll_stop_free(h);
return fails;
}
static int check_ChandelierExit(void) {
struct ChandelierExit *h = wickra_chandelier_exit_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL ChandelierExit: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ChandelierExit", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraChandelierExitOutput out;
if (wickra_chandelier_exit_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.long_stop;
got[gn++] = out.short_stop;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("ChandelierExit", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_chandelier_exit_free(h);
return fails;
}
static int check_ChoppinessIndex(void) {
struct ChoppinessIndex *h = wickra_choppiness_index_new((uintptr_t)14);
if (!h) { printf("FAIL ChoppinessIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ChoppinessIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_choppiness_index_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ChoppinessIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_choppiness_index_free(h);
return fails;
}
static int check_ClassicPivots(void) {
struct ClassicPivots *h = wickra_classic_pivots_new();
if (!h) { printf("FAIL ClassicPivots: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ClassicPivots", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraClassicPivotsOutput out;
if (wickra_classic_pivots_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.pp;
got[gn++] = out.r1;
got[gn++] = out.r2;
got[gn++] = out.r3;
got[gn++] = out.s1;
got[gn++] = out.s2;
got[gn++] = out.s3;
} else {
for (int z = 0; z < 7; z++) got[gn++] = NANV;
}
fails += cmp_row("ClassicPivots", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_classic_pivots_free(h);
return fails;
}
static int check_CloseVsOpen(void) {
struct CloseVsOpen *h = wickra_close_vs_open_new();
if (!h) { printf("FAIL CloseVsOpen: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_CloseVsOpen", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_close_vs_open_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("CloseVsOpen", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_close_vs_open_free(h);
return fails;
}
static int check_ClosingMarubozu(void) {
struct ClosingMarubozu *h = wickra_closing_marubozu_new();
if (!h) { printf("FAIL ClosingMarubozu: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ClosingMarubozu", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_closing_marubozu_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ClosingMarubozu", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_closing_marubozu_free(h);
return fails;
}
static int check_Cmo(void) {
struct Cmo *h = wickra_cmo_new((uintptr_t)14);
if (!h) { printf("FAIL Cmo: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Cmo", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_cmo_update(h, c);
fails += cmp_row("Cmo", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_cmo_free(h);
return fails;
}
static int check_CoefficientOfVariation(void) {
struct CoefficientOfVariation *h = wickra_coefficient_of_variation_new((uintptr_t)14);
if (!h) { printf("FAIL CoefficientOfVariation: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_CoefficientOfVariation", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_coefficient_of_variation_update(h, c);
fails += cmp_row("CoefficientOfVariation", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_coefficient_of_variation_free(h);
return fails;
}
static int check_Cointegration(void) {
struct Cointegration *h = wickra_cointegration_new((uintptr_t)40, (uintptr_t)1);
if (!h) { printf("FAIL Cointegration: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Cointegration", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraCointegrationOutput out;
if (wickra_cointegration_update(h, c, o, &out)) {
got[gn++] = out.hedge_ratio;
got[gn++] = out.spread;
got[gn++] = out.adf_stat;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("Cointegration", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_cointegration_free(h);
return fails;
}
static int check_CommonSenseRatio(void) {
struct CommonSenseRatio *h = wickra_common_sense_ratio_new((uintptr_t)14);
if (!h) { printf("FAIL CommonSenseRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_CommonSenseRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_common_sense_ratio_update(h, c);
fails += cmp_row("CommonSenseRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_common_sense_ratio_free(h);
return fails;
}
static int check_CompositeProfile(void) {
struct CompositeProfile *h = wickra_composite_profile_new((uintptr_t)20, (uintptr_t)24, 0.7);
if (!h) { printf("FAIL CompositeProfile: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_CompositeProfile", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraCompositeProfileOutput out;
if (wickra_composite_profile_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.poc;
got[gn++] = out.vah;
got[gn++] = out.val;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("CompositeProfile", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_composite_profile_free(h);
return fails;
}
static int check_ConcealingBabySwallow(void) {
struct ConcealingBabySwallow *h = wickra_concealing_baby_swallow_new();
if (!h) { printf("FAIL ConcealingBabySwallow: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ConcealingBabySwallow", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_concealing_baby_swallow_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ConcealingBabySwallow", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_concealing_baby_swallow_free(h);
return fails;
}
static int check_ConditionalValueAtRisk(void) {
struct ConditionalValueAtRisk *h = wickra_conditional_value_at_risk_new((uintptr_t)20, 0.95);
if (!h) { printf("FAIL ConditionalValueAtRisk: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ConditionalValueAtRisk", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_conditional_value_at_risk_update(h, c);
fails += cmp_row("ConditionalValueAtRisk", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_conditional_value_at_risk_free(h);
return fails;
}
static int check_ConnorsRsi(void) {
struct ConnorsRsi *h = wickra_connors_rsi_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14);
if (!h) { printf("FAIL ConnorsRsi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ConnorsRsi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_connors_rsi_update(h, c);
fails += cmp_row("ConnorsRsi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_connors_rsi_free(h);
return fails;
}
static int check_Coppock(void) {
struct Coppock *h = wickra_coppock_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14);
if (!h) { printf("FAIL Coppock: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Coppock", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_coppock_update(h, c);
fails += cmp_row("Coppock", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_coppock_free(h);
return fails;
}
static int check_CorrelationTrendIndicator(void) {
struct CorrelationTrendIndicator *h = wickra_correlation_trend_indicator_new((uintptr_t)14);
if (!h) { printf("FAIL CorrelationTrendIndicator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_CorrelationTrendIndicator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_correlation_trend_indicator_update(h, c);
fails += cmp_row("CorrelationTrendIndicator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_correlation_trend_indicator_free(h);
return fails;
}
static int check_Counterattack(void) {
struct Counterattack *h = wickra_counterattack_new();
if (!h) { printf("FAIL Counterattack: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Counterattack", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_counterattack_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Counterattack", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_counterattack_free(h);
return fails;
}
static int check_Crab(void) {
struct Crab *h = wickra_crab_new();
if (!h) { printf("FAIL Crab: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Crab", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_crab_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Crab", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_crab_free(h);
return fails;
}
static int check_CumulativeVolumeDelta(void) {
struct CumulativeVolumeDelta *h = wickra_cumulative_volume_delta_new();
if (!h) { printf("FAIL CumulativeVolumeDelta: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_CumulativeVolumeDelta", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_cumulative_volume_delta_update(h, c, v, c >= o, (int64_t)i);
fails += cmp_row("CumulativeVolumeDelta", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_cumulative_volume_delta_free(h);
return fails;
}
static int check_CumulativeVolumeIndex(void) {
struct CumulativeVolumeIndex *h = wickra_cumulative_volume_index_new();
if (!h) { printf("FAIL CumulativeVolumeIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_CumulativeVolumeIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5];
for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); }
got[gn++] = wickra_cumulative_volume_index_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i);
fails += cmp_row("CumulativeVolumeIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_cumulative_volume_index_free(h);
return fails;
}
static int check_CupAndHandle(void) {
struct CupAndHandle *h = wickra_cup_and_handle_new();
if (!h) { printf("FAIL CupAndHandle: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_CupAndHandle", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_cup_and_handle_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("CupAndHandle", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_cup_and_handle_free(h);
return fails;
}
static int check_CyberneticCycle(void) {
struct CyberneticCycle *h = wickra_cybernetic_cycle_new((uintptr_t)14);
if (!h) { printf("FAIL CyberneticCycle: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_CyberneticCycle", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_cybernetic_cycle_update(h, c);
fails += cmp_row("CyberneticCycle", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_cybernetic_cycle_free(h);
return fails;
}
static int check_Cypher(void) {
struct Cypher *h = wickra_cypher_new();
if (!h) { printf("FAIL Cypher: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Cypher", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_cypher_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Cypher", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_cypher_free(h);
return fails;
}
static int check_DayOfWeekProfile(void) {
struct DayOfWeekProfile *h = wickra_day_of_week_profile_new((int32_t)0);
if (!h) { printf("FAIL DayOfWeekProfile: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DayOfWeekProfile", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double vbuf[256];
intptr_t k = wickra_day_of_week_profile_update(h, o, hi, lo, c, v, (int64_t)i, vbuf, 256);
if (k < 0) { for (int z = 0; z < 7; z++) got[gn++] = NANV; }
else { for (int z = 0; z < 7; z++) got[gn++] = vbuf[z]; }
fails += cmp_row("DayOfWeekProfile", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_day_of_week_profile_free(h);
return fails;
}
static int check_Decycler(void) {
struct Decycler *h = wickra_decycler_new((uintptr_t)14);
if (!h) { printf("FAIL Decycler: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Decycler", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_decycler_update(h, c);
fails += cmp_row("Decycler", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_decycler_free(h);
return fails;
}
static int check_DecyclerOscillator(void) {
struct DecyclerOscillator *h = wickra_decycler_oscillator_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL DecyclerOscillator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DecyclerOscillator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_decycler_oscillator_update(h, c);
fails += cmp_row("DecyclerOscillator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_decycler_oscillator_free(h);
return fails;
}
static int check_Dema(void) {
struct Dema *h = wickra_dema_new((uintptr_t)14);
if (!h) { printf("FAIL Dema: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Dema", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_dema_update(h, c);
fails += cmp_row("Dema", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_dema_free(h);
return fails;
}
static int check_DemandIndex(void) {
struct DemandIndex *h = wickra_demand_index_new((uintptr_t)14);
if (!h) { printf("FAIL DemandIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DemandIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_demand_index_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("DemandIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_demand_index_free(h);
return fails;
}
static int check_DemarkPivots(void) {
struct DemarkPivots *h = wickra_demark_pivots_new();
if (!h) { printf("FAIL DemarkPivots: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DemarkPivots", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraDemarkPivotsOutput out;
if (wickra_demark_pivots_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.pp;
got[gn++] = out.r1;
got[gn++] = out.s1;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("DemarkPivots", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_demark_pivots_free(h);
return fails;
}
static int check_DepthSlope(void) {
struct DepthSlope *h = wickra_depth_slope_new();
if (!h) { printf("FAIL DepthSlope: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DepthSlope", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double bp[5], bs[5], ap[5], asz[5];
for (int k = 0; k < 5; k++) { double kf = k + 1; bp[k] = c - 0.1*kf; bs[k] = v/kf; ap[k] = c + 0.1*kf; asz[k] = v*0.9/kf; }
got[gn++] = wickra_depth_slope_update(h, bp, bs, 5, ap, asz, 5);
fails += cmp_row("DepthSlope", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_depth_slope_free(h);
return fails;
}
static int check_DerivativeOscillator(void) {
struct DerivativeOscillator *h = wickra_derivative_oscillator_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14, (uintptr_t)28);
if (!h) { printf("FAIL DerivativeOscillator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DerivativeOscillator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_derivative_oscillator_update(h, c);
fails += cmp_row("DerivativeOscillator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_derivative_oscillator_free(h);
return fails;
}
static int check_DetrendedStdDev(void) {
struct DetrendedStdDev *h = wickra_detrended_std_dev_new((uintptr_t)14);
if (!h) { printf("FAIL DetrendedStdDev: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DetrendedStdDev", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_detrended_std_dev_update(h, c);
fails += cmp_row("DetrendedStdDev", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_detrended_std_dev_free(h);
return fails;
}
static int check_DisparityIndex(void) {
struct DisparityIndex *h = wickra_disparity_index_new((uintptr_t)14);
if (!h) { printf("FAIL DisparityIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DisparityIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_disparity_index_update(h, c);
fails += cmp_row("DisparityIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_disparity_index_free(h);
return fails;
}
static int check_DistanceSsd(void) {
struct DistanceSsd *h = wickra_distance_ssd_new((uintptr_t)14);
if (!h) { printf("FAIL DistanceSsd: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DistanceSsd", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_distance_ssd_update(h, c, o);
fails += cmp_row("DistanceSsd", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_distance_ssd_free(h);
return fails;
}
static int check_Doji(void) {
struct Doji *h = wickra_doji_new();
if (!h) { printf("FAIL Doji: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Doji", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_doji_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Doji", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_doji_free(h);
return fails;
}
static int check_DojiStar(void) {
struct DojiStar *h = wickra_doji_star_new();
if (!h) { printf("FAIL DojiStar: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DojiStar", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_doji_star_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("DojiStar", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_doji_star_free(h);
return fails;
}
static int check_DollarBars(void) {
struct DollarBars *h = wickra_dollar_bars_new(50000.0);
if (!h) { printf("FAIL DollarBars: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DollarBars", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraDollarBar bbuf[256];
uintptr_t k = wickra_dollar_bars_update(h, o, hi, lo, c, v, 0, bbuf, 256);
for (uintptr_t b = 0; b < (uintptr_t)k; b++) {
got[gn++] = (double)bbuf[b].open;
got[gn++] = (double)bbuf[b].high;
got[gn++] = (double)bbuf[b].low;
got[gn++] = (double)bbuf[b].close;
got[gn++] = (double)bbuf[b].volume;
got[gn++] = (double)bbuf[b].dollar;
}
fails += cmp_row("DollarBars", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_dollar_bars_free(h);
return fails;
}
static int check_Donchian(void) {
struct Donchian *h = wickra_donchian_new((uintptr_t)14);
if (!h) { printf("FAIL Donchian: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Donchian", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraDonchianOutput out;
if (wickra_donchian_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.upper;
got[gn++] = out.middle;
got[gn++] = out.lower;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("Donchian", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_donchian_free(h);
return fails;
}
static int check_DonchianStop(void) {
struct DonchianStop *h = wickra_donchian_stop_new((uintptr_t)14);
if (!h) { printf("FAIL DonchianStop: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DonchianStop", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraDonchianStopOutput out;
if (wickra_donchian_stop_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.stop_long;
got[gn++] = out.stop_short;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("DonchianStop", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_donchian_stop_free(h);
return fails;
}
static int check_DoubleBollinger(void) {
struct DoubleBollinger *h = wickra_double_bollinger_new((uintptr_t)20, 1.0, 2.0);
if (!h) { printf("FAIL DoubleBollinger: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DoubleBollinger", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraDoubleBollingerOutput out;
if (wickra_double_bollinger_update(h, c, &out)) {
got[gn++] = out.upper_outer;
got[gn++] = out.upper_inner;
got[gn++] = out.middle;
got[gn++] = out.lower_inner;
got[gn++] = out.lower_outer;
} else {
for (int z = 0; z < 5; z++) got[gn++] = NANV;
}
fails += cmp_row("DoubleBollinger", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_double_bollinger_free(h);
return fails;
}
static int check_DoubleTopBottom(void) {
struct DoubleTopBottom *h = wickra_double_top_bottom_new();
if (!h) { printf("FAIL DoubleTopBottom: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DoubleTopBottom", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_double_top_bottom_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("DoubleTopBottom", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_double_top_bottom_free(h);
return fails;
}
static int check_DownsideGapThreeMethods(void) {
struct DownsideGapThreeMethods *h = wickra_downside_gap_three_methods_new();
if (!h) { printf("FAIL DownsideGapThreeMethods: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DownsideGapThreeMethods", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_downside_gap_three_methods_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("DownsideGapThreeMethods", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_downside_gap_three_methods_free(h);
return fails;
}
static int check_Dpo(void) {
struct Dpo *h = wickra_dpo_new((uintptr_t)14);
if (!h) { printf("FAIL Dpo: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Dpo", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_dpo_update(h, c);
fails += cmp_row("Dpo", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_dpo_free(h);
return fails;
}
static int check_DragonflyDoji(void) {
struct DragonflyDoji *h = wickra_dragonfly_doji_new();
if (!h) { printf("FAIL DragonflyDoji: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DragonflyDoji", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_dragonfly_doji_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("DragonflyDoji", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_dragonfly_doji_free(h);
return fails;
}
static int check_DrawdownDuration(void) {
struct DrawdownDuration *h = wickra_drawdown_duration_new();
if (!h) { printf("FAIL DrawdownDuration: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DrawdownDuration", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_drawdown_duration_update(h, c);
fails += cmp_row("DrawdownDuration", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_drawdown_duration_free(h);
return fails;
}
static int check_DumplingTop(void) {
struct DumplingTop *h = wickra_dumpling_top_new((uintptr_t)14);
if (!h) { printf("FAIL DumplingTop: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DumplingTop", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_dumpling_top_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("DumplingTop", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_dumpling_top_free(h);
return fails;
}
static int check_Dx(void) {
struct Dx *h = wickra_dx_new((uintptr_t)14);
if (!h) { printf("FAIL Dx: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Dx", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_dx_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Dx", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_dx_free(h);
return fails;
}
static int check_DynamicMomentumIndex(void) {
struct DynamicMomentumIndex *h = wickra_dynamic_momentum_index_new((uintptr_t)14);
if (!h) { printf("FAIL DynamicMomentumIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_DynamicMomentumIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_dynamic_momentum_index_update(h, c);
fails += cmp_row("DynamicMomentumIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_dynamic_momentum_index_free(h);
return fails;
}
static int check_EaseOfMovement(void) {
struct EaseOfMovement *h = wickra_ease_of_movement_new((uintptr_t)14);
if (!h) { printf("FAIL EaseOfMovement: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_EaseOfMovement", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_ease_of_movement_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("EaseOfMovement", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ease_of_movement_free(h);
return fails;
}
static int check_EffectiveSpread(void) {
struct EffectiveSpread *h = wickra_effective_spread_new();
if (!h) { printf("FAIL EffectiveSpread: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_EffectiveSpread", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_effective_spread_update(h, c, v, c >= o, (int64_t)i, (hi + lo) / 2.0);
fails += cmp_row("EffectiveSpread", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_effective_spread_free(h);
return fails;
}
static int check_EhlersStochastic(void) {
struct EhlersStochastic *h = wickra_ehlers_stochastic_new((uintptr_t)14);
if (!h) { printf("FAIL EhlersStochastic: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_EhlersStochastic", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_ehlers_stochastic_update(h, c);
fails += cmp_row("EhlersStochastic", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ehlers_stochastic_free(h);
return fails;
}
static int check_Ehma(void) {
struct Ehma *h = wickra_ehma_new((uintptr_t)14);
if (!h) { printf("FAIL Ehma: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Ehma", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_ehma_update(h, c);
fails += cmp_row("Ehma", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ehma_free(h);
return fails;
}
static int check_ElderImpulse(void) {
struct ElderImpulse *h = wickra_elder_impulse_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14, (uintptr_t)28);
if (!h) { printf("FAIL ElderImpulse: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ElderImpulse", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_elder_impulse_update(h, c);
fails += cmp_row("ElderImpulse", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_elder_impulse_free(h);
return fails;
}
static int check_ElderRay(void) {
struct ElderRay *h = wickra_elder_ray_new((uintptr_t)14);
if (!h) { printf("FAIL ElderRay: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ElderRay", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraElderRayOutput out;
if (wickra_elder_ray_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.bull_power;
got[gn++] = out.bear_power;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("ElderRay", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_elder_ray_free(h);
return fails;
}
static int check_ElderSafeZone(void) {
struct ElderSafeZone *h = wickra_elder_safe_zone_new((uintptr_t)10, 2.0);
if (!h) { printf("FAIL ElderSafeZone: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ElderSafeZone", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraElderSafeZoneOutput out;
if (wickra_elder_safe_zone_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.value;
got[gn++] = out.direction;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("ElderSafeZone", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_elder_safe_zone_free(h);
return fails;
}
static int check_Ema(void) {
struct Ema *h = wickra_ema_new((uintptr_t)14);
if (!h) { printf("FAIL Ema: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Ema", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_ema_update(h, c);
fails += cmp_row("Ema", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ema_free(h);
return fails;
}
static int check_EmpiricalModeDecomposition(void) {
struct EmpiricalModeDecomposition *h = wickra_empirical_mode_decomposition_new((uintptr_t)20, 0.1);
if (!h) { printf("FAIL EmpiricalModeDecomposition: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_EmpiricalModeDecomposition", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_empirical_mode_decomposition_update(h, c);
fails += cmp_row("EmpiricalModeDecomposition", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_empirical_mode_decomposition_free(h);
return fails;
}
static int check_Engulfing(void) {
struct Engulfing *h = wickra_engulfing_new();
if (!h) { printf("FAIL Engulfing: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Engulfing", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_engulfing_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Engulfing", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_engulfing_free(h);
return fails;
}
static int check_Equivolume(void) {
struct Equivolume *h = wickra_equivolume_new((uintptr_t)14);
if (!h) { printf("FAIL Equivolume: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Equivolume", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraEquivolumeOutput out;
if (wickra_equivolume_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.height;
got[gn++] = out.width;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("Equivolume", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_equivolume_free(h);
return fails;
}
static int check_EstimatedLeverageRatio(void) {
struct EstimatedLeverageRatio *h = wickra_estimated_leverage_ratio_new();
if (!h) { printf("FAIL EstimatedLeverageRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_EstimatedLeverageRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo;
got[gn++] = wickra_estimated_leverage_ratio_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i);
fails += cmp_row("EstimatedLeverageRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_estimated_leverage_ratio_free(h);
return fails;
}
static int check_EvenBetterSinewave(void) {
struct EvenBetterSinewave *h = wickra_even_better_sinewave_new((uintptr_t)40, (uintptr_t)10);
if (!h) { printf("FAIL EvenBetterSinewave: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_EvenBetterSinewave", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_even_better_sinewave_update(h, c);
fails += cmp_row("EvenBetterSinewave", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_even_better_sinewave_free(h);
return fails;
}
static int check_EveningDojiStar(void) {
struct EveningDojiStar *h = wickra_evening_doji_star_new();
if (!h) { printf("FAIL EveningDojiStar: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_EveningDojiStar", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_evening_doji_star_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("EveningDojiStar", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_evening_doji_star_free(h);
return fails;
}
static int check_Evwma(void) {
struct Evwma *h = wickra_evwma_new((uintptr_t)14);
if (!h) { printf("FAIL Evwma: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Evwma", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_evwma_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Evwma", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_evwma_free(h);
return fails;
}
static int check_EwmaVolatility(void) {
struct EwmaVolatility *h = wickra_ewma_volatility_new(0.94);
if (!h) { printf("FAIL EwmaVolatility: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_EwmaVolatility", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_ewma_volatility_update(h, c);
fails += cmp_row("EwmaVolatility", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ewma_volatility_free(h);
return fails;
}
static int check_Expectancy(void) {
struct Expectancy *h = wickra_expectancy_new((uintptr_t)14);
if (!h) { printf("FAIL Expectancy: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Expectancy", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_expectancy_update(h, c);
fails += cmp_row("Expectancy", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_expectancy_free(h);
return fails;
}
static int check_FallingThreeMethods(void) {
struct FallingThreeMethods *h = wickra_falling_three_methods_new();
if (!h) { printf("FAIL FallingThreeMethods: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FallingThreeMethods", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_falling_three_methods_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("FallingThreeMethods", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_falling_three_methods_free(h);
return fails;
}
static int check_Fama(void) {
struct Fama *h = wickra_fama_new(0.5, 0.05);
if (!h) { printf("FAIL Fama: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Fama", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_fama_update(h, c);
fails += cmp_row("Fama", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_fama_free(h);
return fails;
}
static int check_FibArcs(void) {
struct FibArcs *h = wickra_fib_arcs_new();
if (!h) { printf("FAIL FibArcs: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FibArcs", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraFibArcsOutput out;
if (wickra_fib_arcs_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.arc_382;
got[gn++] = out.arc_500;
got[gn++] = out.arc_618;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("FibArcs", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_fib_arcs_free(h);
return fails;
}
static int check_FibChannel(void) {
struct FibChannel *h = wickra_fib_channel_new();
if (!h) { printf("FAIL FibChannel: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FibChannel", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraFibChannelOutput out;
if (wickra_fib_channel_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.base;
got[gn++] = out.level_618;
got[gn++] = out.level_1000;
got[gn++] = out.level_1618;
} else {
for (int z = 0; z < 4; z++) got[gn++] = NANV;
}
fails += cmp_row("FibChannel", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_fib_channel_free(h);
return fails;
}
static int check_FibConfluence(void) {
struct FibConfluence *h = wickra_fib_confluence_new();
if (!h) { printf("FAIL FibConfluence: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FibConfluence", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraFibConfluenceOutput out;
if (wickra_fib_confluence_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.price;
got[gn++] = out.strength;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("FibConfluence", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_fib_confluence_free(h);
return fails;
}
static int check_FibExtension(void) {
struct FibExtension *h = wickra_fib_extension_new();
if (!h) { printf("FAIL FibExtension: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FibExtension", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraFibExtensionOutput out;
if (wickra_fib_extension_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.level_1272;
got[gn++] = out.level_1414;
got[gn++] = out.level_1618;
got[gn++] = out.level_2000;
got[gn++] = out.level_2618;
} else {
for (int z = 0; z < 5; z++) got[gn++] = NANV;
}
fails += cmp_row("FibExtension", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_fib_extension_free(h);
return fails;
}
static int check_FibFan(void) {
struct FibFan *h = wickra_fib_fan_new();
if (!h) { printf("FAIL FibFan: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FibFan", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraFibFanOutput out;
if (wickra_fib_fan_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.fan_382;
got[gn++] = out.fan_500;
got[gn++] = out.fan_618;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("FibFan", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_fib_fan_free(h);
return fails;
}
static int check_FibProjection(void) {
struct FibProjection *h = wickra_fib_projection_new();
if (!h) { printf("FAIL FibProjection: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FibProjection", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraFibProjectionOutput out;
if (wickra_fib_projection_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.level_618;
got[gn++] = out.level_1000;
got[gn++] = out.level_1618;
got[gn++] = out.level_2618;
} else {
for (int z = 0; z < 4; z++) got[gn++] = NANV;
}
fails += cmp_row("FibProjection", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_fib_projection_free(h);
return fails;
}
static int check_FibRetracement(void) {
struct FibRetracement *h = wickra_fib_retracement_new();
if (!h) { printf("FAIL FibRetracement: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FibRetracement", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraFibRetracementOutput out;
if (wickra_fib_retracement_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.level_0;
got[gn++] = out.level_236;
got[gn++] = out.level_382;
got[gn++] = out.level_500;
got[gn++] = out.level_618;
got[gn++] = out.level_786;
got[gn++] = out.level_1000;
} else {
for (int z = 0; z < 7; z++) got[gn++] = NANV;
}
fails += cmp_row("FibRetracement", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_fib_retracement_free(h);
return fails;
}
static int check_FibTimeZones(void) {
struct FibTimeZones *h = wickra_fib_time_zones_new();
if (!h) { printf("FAIL FibTimeZones: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FibTimeZones", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraFibTimeZonesOutput out;
if (wickra_fib_time_zones_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.on_zone;
got[gn++] = out.bars_to_next;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("FibTimeZones", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_fib_time_zones_free(h);
return fails;
}
static int check_FibonacciPivots(void) {
struct FibonacciPivots *h = wickra_fibonacci_pivots_new();
if (!h) { printf("FAIL FibonacciPivots: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FibonacciPivots", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraFibonacciPivotsOutput out;
if (wickra_fibonacci_pivots_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.pp;
got[gn++] = out.r1;
got[gn++] = out.r2;
got[gn++] = out.r3;
got[gn++] = out.s1;
got[gn++] = out.s2;
got[gn++] = out.s3;
} else {
for (int z = 0; z < 7; z++) got[gn++] = NANV;
}
fails += cmp_row("FibonacciPivots", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_fibonacci_pivots_free(h);
return fails;
}
static int check_FisherRsi(void) {
struct FisherRsi *h = wickra_fisher_rsi_new((uintptr_t)14);
if (!h) { printf("FAIL FisherRsi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FisherRsi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_fisher_rsi_update(h, c);
fails += cmp_row("FisherRsi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_fisher_rsi_free(h);
return fails;
}
static int check_FisherTransform(void) {
struct FisherTransform *h = wickra_fisher_transform_new((uintptr_t)14);
if (!h) { printf("FAIL FisherTransform: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FisherTransform", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_fisher_transform_update(h, c);
fails += cmp_row("FisherTransform", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_fisher_transform_free(h);
return fails;
}
static int check_FlagPennant(void) {
struct FlagPennant *h = wickra_flag_pennant_new();
if (!h) { printf("FAIL FlagPennant: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FlagPennant", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_flag_pennant_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("FlagPennant", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_flag_pennant_free(h);
return fails;
}
static int check_Footprint(void) {
struct Footprint *h = wickra_footprint_new(1.0);
if (!h) { printf("FAIL Footprint: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Footprint", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraFootprintLevel bbuf[256];
intptr_t k = wickra_footprint_update(h, c, v, c >= o, (int64_t)i, bbuf, 256);
if (k < 0) k = 0;
for (uintptr_t b = 0; b < (uintptr_t)k; b++) {
got[gn++] = (double)bbuf[b].price;
got[gn++] = (double)bbuf[b].bid_vol;
got[gn++] = (double)bbuf[b].ask_vol;
}
fails += cmp_row("Footprint", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_footprint_free(h);
return fails;
}
static int check_ForceIndex(void) {
struct ForceIndex *h = wickra_force_index_new((uintptr_t)14);
if (!h) { printf("FAIL ForceIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ForceIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_force_index_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ForceIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_force_index_free(h);
return fails;
}
static int check_FractalChaosBands(void) {
struct FractalChaosBands *h = wickra_fractal_chaos_bands_new((uintptr_t)14);
if (!h) { printf("FAIL FractalChaosBands: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FractalChaosBands", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraFractalChaosBandsOutput out;
if (wickra_fractal_chaos_bands_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.upper;
got[gn++] = out.lower;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("FractalChaosBands", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_fractal_chaos_bands_free(h);
return fails;
}
static int check_Frama(void) {
struct Frama *h = wickra_frama_new((uintptr_t)14);
if (!h) { printf("FAIL Frama: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Frama", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_frama_update(h, c);
fails += cmp_row("Frama", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_frama_free(h);
return fails;
}
static int check_FryPanBottom(void) {
struct FryPanBottom *h = wickra_fry_pan_bottom_new((uintptr_t)14);
if (!h) { printf("FAIL FryPanBottom: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FryPanBottom", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_fry_pan_bottom_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("FryPanBottom", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_fry_pan_bottom_free(h);
return fails;
}
static int check_FundingBasis(void) {
struct FundingBasis *h = wickra_funding_basis_new();
if (!h) { printf("FAIL FundingBasis: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FundingBasis", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo;
got[gn++] = wickra_funding_basis_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i);
fails += cmp_row("FundingBasis", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_funding_basis_free(h);
return fails;
}
static int check_FundingImpliedApr(void) {
struct FundingImpliedApr *h = wickra_funding_implied_apr_new(1095.0);
if (!h) { printf("FAIL FundingImpliedApr: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FundingImpliedApr", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo;
got[gn++] = wickra_funding_implied_apr_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i);
fails += cmp_row("FundingImpliedApr", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_funding_implied_apr_free(h);
return fails;
}
static int check_FundingRate(void) {
struct FundingRate *h = wickra_funding_rate_new();
if (!h) { printf("FAIL FundingRate: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FundingRate", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo;
got[gn++] = wickra_funding_rate_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i);
fails += cmp_row("FundingRate", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_funding_rate_free(h);
return fails;
}
static int check_FundingRateMean(void) {
struct FundingRateMean *h = wickra_funding_rate_mean_new((uintptr_t)20);
if (!h) { printf("FAIL FundingRateMean: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FundingRateMean", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo;
got[gn++] = wickra_funding_rate_mean_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i);
fails += cmp_row("FundingRateMean", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_funding_rate_mean_free(h);
return fails;
}
static int check_FundingRateZScore(void) {
struct FundingRateZScore *h = wickra_funding_rate_z_score_new((uintptr_t)20);
if (!h) { printf("FAIL FundingRateZScore: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_FundingRateZScore", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo;
got[gn++] = wickra_funding_rate_z_score_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i);
fails += cmp_row("FundingRateZScore", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_funding_rate_z_score_free(h);
return fails;
}
static int check_GainLossRatio(void) {
struct GainLossRatio *h = wickra_gain_loss_ratio_new((uintptr_t)14);
if (!h) { printf("FAIL GainLossRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_GainLossRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_gain_loss_ratio_update(h, c);
fails += cmp_row("GainLossRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_gain_loss_ratio_free(h);
return fails;
}
static int check_GainToPainRatio(void) {
struct GainToPainRatio *h = wickra_gain_to_pain_ratio_new((uintptr_t)14);
if (!h) { printf("FAIL GainToPainRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_GainToPainRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_gain_to_pain_ratio_update(h, c);
fails += cmp_row("GainToPainRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_gain_to_pain_ratio_free(h);
return fails;
}
static int check_GapSideBySideWhite(void) {
struct GapSideBySideWhite *h = wickra_gap_side_by_side_white_new();
if (!h) { printf("FAIL GapSideBySideWhite: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_GapSideBySideWhite", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_gap_side_by_side_white_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("GapSideBySideWhite", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_gap_side_by_side_white_free(h);
return fails;
}
static int check_Garch11(void) {
struct Garch11 *h = wickra_garch11_new(2e-06, 0.1, 0.88);
if (!h) { printf("FAIL Garch11: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Garch11", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_garch11_update(h, c);
fails += cmp_row("Garch11", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_garch11_free(h);
return fails;
}
static int check_GarmanKlassVolatility(void) {
struct GarmanKlassVolatility *h = wickra_garman_klass_volatility_new((uintptr_t)20, (uintptr_t)252);
if (!h) { printf("FAIL GarmanKlassVolatility: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_GarmanKlassVolatility", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_garman_klass_volatility_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("GarmanKlassVolatility", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_garman_klass_volatility_free(h);
return fails;
}
static int check_Gartley(void) {
struct Gartley *h = wickra_gartley_new();
if (!h) { printf("FAIL Gartley: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Gartley", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_gartley_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Gartley", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_gartley_free(h);
return fails;
}
static int check_GatorOscillator(void) {
struct GatorOscillator *h = wickra_gator_oscillator_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14);
if (!h) { printf("FAIL GatorOscillator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_GatorOscillator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraGatorOscillatorOutput out;
if (wickra_gator_oscillator_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.upper;
got[gn++] = out.lower;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("GatorOscillator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_gator_oscillator_free(h);
return fails;
}
static int check_GeneralizedDema(void) {
struct GeneralizedDema *h = wickra_generalized_dema_new((uintptr_t)5, 0.7);
if (!h) { printf("FAIL GeneralizedDema: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_GeneralizedDema", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_generalized_dema_update(h, c);
fails += cmp_row("GeneralizedDema", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_generalized_dema_free(h);
return fails;
}
static int check_GeometricMa(void) {
struct GeometricMa *h = wickra_geometric_ma_new((uintptr_t)14);
if (!h) { printf("FAIL GeometricMa: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_GeometricMa", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_geometric_ma_update(h, c);
fails += cmp_row("GeometricMa", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_geometric_ma_free(h);
return fails;
}
static int check_GoldenPocket(void) {
struct GoldenPocket *h = wickra_golden_pocket_new();
if (!h) { printf("FAIL GoldenPocket: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_GoldenPocket", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraGoldenPocketOutput out;
if (wickra_golden_pocket_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.low;
got[gn++] = out.mid;
got[gn++] = out.high;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("GoldenPocket", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_golden_pocket_free(h);
return fails;
}
static int check_GrangerCausality(void) {
struct GrangerCausality *h = wickra_granger_causality_new((uintptr_t)60, (uintptr_t)1);
if (!h) { printf("FAIL GrangerCausality: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_GrangerCausality", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_granger_causality_update(h, c, o);
fails += cmp_row("GrangerCausality", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_granger_causality_free(h);
return fails;
}
static int check_GravestoneDoji(void) {
struct GravestoneDoji *h = wickra_gravestone_doji_new();
if (!h) { printf("FAIL GravestoneDoji: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_GravestoneDoji", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_gravestone_doji_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("GravestoneDoji", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_gravestone_doji_free(h);
return fails;
}
static int check_Hammer(void) {
struct Hammer *h = wickra_hammer_new();
if (!h) { printf("FAIL Hammer: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Hammer", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_hammer_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Hammer", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_hammer_free(h);
return fails;
}
static int check_HangingMan(void) {
struct HangingMan *h = wickra_hanging_man_new();
if (!h) { printf("FAIL HangingMan: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HangingMan", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_hanging_man_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("HangingMan", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_hanging_man_free(h);
return fails;
}
static int check_Harami(void) {
struct Harami *h = wickra_harami_new();
if (!h) { printf("FAIL Harami: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Harami", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_harami_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Harami", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_harami_free(h);
return fails;
}
static int check_HaramiCross(void) {
struct HaramiCross *h = wickra_harami_cross_new();
if (!h) { printf("FAIL HaramiCross: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HaramiCross", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_harami_cross_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("HaramiCross", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_harami_cross_free(h);
return fails;
}
static int check_HasbrouckInformationShare(void) {
struct HasbrouckInformationShare *h = wickra_hasbrouck_information_share_new((uintptr_t)14);
if (!h) { printf("FAIL HasbrouckInformationShare: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HasbrouckInformationShare", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_hasbrouck_information_share_update(h, c, o);
fails += cmp_row("HasbrouckInformationShare", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_hasbrouck_information_share_free(h);
return fails;
}
static int check_HeadAndShoulders(void) {
struct HeadAndShoulders *h = wickra_head_and_shoulders_new();
if (!h) { printf("FAIL HeadAndShoulders: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HeadAndShoulders", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_head_and_shoulders_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("HeadAndShoulders", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_head_and_shoulders_free(h);
return fails;
}
static int check_HeikinAshi(void) {
struct HeikinAshi *h = wickra_heikin_ashi_new();
if (!h) { printf("FAIL HeikinAshi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HeikinAshi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraHeikinAshiOutput out;
if (wickra_heikin_ashi_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.open;
got[gn++] = out.high;
got[gn++] = out.low;
got[gn++] = out.close;
} else {
for (int z = 0; z < 4; z++) got[gn++] = NANV;
}
fails += cmp_row("HeikinAshi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_heikin_ashi_free(h);
return fails;
}
static int check_HeikinAshiOscillator(void) {
struct HeikinAshiOscillator *h = wickra_heikin_ashi_oscillator_new((uintptr_t)14);
if (!h) { printf("FAIL HeikinAshiOscillator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HeikinAshiOscillator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_heikin_ashi_oscillator_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("HeikinAshiOscillator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_heikin_ashi_oscillator_free(h);
return fails;
}
static int check_HiLoActivator(void) {
struct HiLoActivator *h = wickra_hi_lo_activator_new((uintptr_t)14);
if (!h) { printf("FAIL HiLoActivator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HiLoActivator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_hi_lo_activator_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("HiLoActivator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_hi_lo_activator_free(h);
return fails;
}
static int check_HighLowIndex(void) {
struct HighLowIndex *h = wickra_high_low_index_new((uintptr_t)10);
if (!h) { printf("FAIL HighLowIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HighLowIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5];
for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); }
got[gn++] = wickra_high_low_index_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i);
fails += cmp_row("HighLowIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_high_low_index_free(h);
return fails;
}
static int check_HighLowRange(void) {
struct HighLowRange *h = wickra_high_low_range_new();
if (!h) { printf("FAIL HighLowRange: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HighLowRange", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_high_low_range_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("HighLowRange", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_high_low_range_free(h);
return fails;
}
static int check_HighLowVolumeNodes(void) {
struct HighLowVolumeNodes *h = wickra_high_low_volume_nodes_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL HighLowVolumeNodes: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HighLowVolumeNodes", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraHighLowVolumeNodesOutput out;
if (wickra_high_low_volume_nodes_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.hvn;
got[gn++] = out.lvn;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("HighLowVolumeNodes", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_high_low_volume_nodes_free(h);
return fails;
}
static int check_HighWave(void) {
struct HighWave *h = wickra_high_wave_new();
if (!h) { printf("FAIL HighWave: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HighWave", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_high_wave_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("HighWave", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_high_wave_free(h);
return fails;
}
static int check_HighpassFilter(void) {
struct HighpassFilter *h = wickra_highpass_filter_new((uintptr_t)14);
if (!h) { printf("FAIL HighpassFilter: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HighpassFilter", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_highpass_filter_update(h, c);
fails += cmp_row("HighpassFilter", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_highpass_filter_free(h);
return fails;
}
static int check_Hikkake(void) {
struct Hikkake *h = wickra_hikkake_new();
if (!h) { printf("FAIL Hikkake: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Hikkake", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_hikkake_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Hikkake", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_hikkake_free(h);
return fails;
}
static int check_HikkakeModified(void) {
struct HikkakeModified *h = wickra_hikkake_modified_new();
if (!h) { printf("FAIL HikkakeModified: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HikkakeModified", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_hikkake_modified_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("HikkakeModified", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_hikkake_modified_free(h);
return fails;
}
static int check_HilbertDominantCycle(void) {
struct HilbertDominantCycle *h = wickra_hilbert_dominant_cycle_new();
if (!h) { printf("FAIL HilbertDominantCycle: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HilbertDominantCycle", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_hilbert_dominant_cycle_update(h, c);
fails += cmp_row("HilbertDominantCycle", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_hilbert_dominant_cycle_free(h);
return fails;
}
static int check_HistoricalVolatility(void) {
struct HistoricalVolatility *h = wickra_historical_volatility_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL HistoricalVolatility: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HistoricalVolatility", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_historical_volatility_update(h, c);
fails += cmp_row("HistoricalVolatility", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_historical_volatility_free(h);
return fails;
}
static int check_Hma(void) {
struct Hma *h = wickra_hma_new((uintptr_t)14);
if (!h) { printf("FAIL Hma: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Hma", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_hma_update(h, c);
fails += cmp_row("Hma", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_hma_free(h);
return fails;
}
static int check_HoltWinters(void) {
struct HoltWinters *h = wickra_holt_winters_new(0.5, 0.1);
if (!h) { printf("FAIL HoltWinters: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HoltWinters", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_holt_winters_update(h, c);
fails += cmp_row("HoltWinters", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_holt_winters_free(h);
return fails;
}
static int check_HomingPigeon(void) {
struct HomingPigeon *h = wickra_homing_pigeon_new();
if (!h) { printf("FAIL HomingPigeon: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HomingPigeon", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_homing_pigeon_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("HomingPigeon", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_homing_pigeon_free(h);
return fails;
}
static int check_HtDcPhase(void) {
struct HtDcPhase *h = wickra_ht_dc_phase_new();
if (!h) { printf("FAIL HtDcPhase: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HtDcPhase", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_ht_dc_phase_update(h, c);
fails += cmp_row("HtDcPhase", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ht_dc_phase_free(h);
return fails;
}
static int check_HtPhasor(void) {
struct HtPhasor *h = wickra_ht_phasor_new();
if (!h) { printf("FAIL HtPhasor: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HtPhasor", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraHtPhasorOutput out;
if (wickra_ht_phasor_update(h, c, &out)) {
got[gn++] = out.inphase;
got[gn++] = out.quadrature;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("HtPhasor", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ht_phasor_free(h);
return fails;
}
static int check_HtTrendMode(void) {
struct HtTrendMode *h = wickra_ht_trend_mode_new();
if (!h) { printf("FAIL HtTrendMode: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HtTrendMode", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_ht_trend_mode_update(h, c);
fails += cmp_row("HtTrendMode", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ht_trend_mode_free(h);
return fails;
}
static int check_HurstChannel(void) {
struct HurstChannel *h = wickra_hurst_channel_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL HurstChannel: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HurstChannel", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraHurstChannelOutput out;
if (wickra_hurst_channel_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.upper;
got[gn++] = out.middle;
got[gn++] = out.lower;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("HurstChannel", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_hurst_channel_free(h);
return fails;
}
static int check_HurstExponent(void) {
struct HurstExponent *h = wickra_hurst_exponent_new((uintptr_t)100, (uintptr_t)4);
if (!h) { printf("FAIL HurstExponent: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_HurstExponent", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_hurst_exponent_update(h, c);
fails += cmp_row("HurstExponent", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_hurst_exponent_free(h);
return fails;
}
static int check_Ichimoku(void) {
struct Ichimoku *h = wickra_ichimoku_new((uintptr_t)9, (uintptr_t)26, (uintptr_t)52, (uintptr_t)26);
if (!h) { printf("FAIL Ichimoku: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Ichimoku", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraIchimokuOutput out;
if (wickra_ichimoku_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.tenkan;
got[gn++] = out.kijun;
got[gn++] = out.senkou_a;
got[gn++] = out.senkou_b;
got[gn++] = out.chikou;
} else {
for (int z = 0; z < 5; z++) got[gn++] = NANV;
}
fails += cmp_row("Ichimoku", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ichimoku_free(h);
return fails;
}
static int check_IdenticalThreeCrows(void) {
struct IdenticalThreeCrows *h = wickra_identical_three_crows_new();
if (!h) { printf("FAIL IdenticalThreeCrows: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_IdenticalThreeCrows", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_identical_three_crows_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("IdenticalThreeCrows", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_identical_three_crows_free(h);
return fails;
}
static int check_ImbalanceBars(void) {
struct ImbalanceBars *h = wickra_imbalance_bars_new(5.0);
if (!h) { printf("FAIL ImbalanceBars: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ImbalanceBars", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraImbalanceBar bbuf[256];
uintptr_t k = wickra_imbalance_bars_update(h, o, hi, lo, c, 1.0, 0, bbuf, 256);
for (uintptr_t b = 0; b < (uintptr_t)k; b++) {
got[gn++] = (double)bbuf[b].open;
got[gn++] = (double)bbuf[b].high;
got[gn++] = (double)bbuf[b].low;
got[gn++] = (double)bbuf[b].close;
got[gn++] = (double)bbuf[b].imbalance;
got[gn++] = (double)bbuf[b].direction;
}
fails += cmp_row("ImbalanceBars", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_imbalance_bars_free(h);
return fails;
}
static int check_InNeck(void) {
struct InNeck *h = wickra_in_neck_new();
if (!h) { printf("FAIL InNeck: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_InNeck", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_in_neck_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("InNeck", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_in_neck_free(h);
return fails;
}
static int check_Inertia(void) {
struct Inertia *h = wickra_inertia_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL Inertia: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Inertia", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_inertia_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Inertia", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_inertia_free(h);
return fails;
}
static int check_InformationRatio(void) {
struct InformationRatio *h = wickra_information_ratio_new((uintptr_t)14);
if (!h) { printf("FAIL InformationRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_InformationRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_information_ratio_update(h, c, o);
fails += cmp_row("InformationRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_information_ratio_free(h);
return fails;
}
static int check_InitialBalance(void) {
struct InitialBalance *h = wickra_initial_balance_new((uintptr_t)14);
if (!h) { printf("FAIL InitialBalance: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_InitialBalance", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraInitialBalanceOutput out;
if (wickra_initial_balance_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.high;
got[gn++] = out.low;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("InitialBalance", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_initial_balance_free(h);
return fails;
}
static int check_InstantaneousTrendline(void) {
struct InstantaneousTrendline *h = wickra_instantaneous_trendline_new((uintptr_t)14);
if (!h) { printf("FAIL InstantaneousTrendline: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_InstantaneousTrendline", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_instantaneous_trendline_update(h, c);
fails += cmp_row("InstantaneousTrendline", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_instantaneous_trendline_free(h);
return fails;
}
static int check_IntradayIntensity(void) {
struct IntradayIntensity *h = wickra_intraday_intensity_new();
if (!h) { printf("FAIL IntradayIntensity: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_IntradayIntensity", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_intraday_intensity_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("IntradayIntensity", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_intraday_intensity_free(h);
return fails;
}
static int check_IntradayMomentumIndex(void) {
struct IntradayMomentumIndex *h = wickra_intraday_momentum_index_new((uintptr_t)14);
if (!h) { printf("FAIL IntradayMomentumIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_IntradayMomentumIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_intraday_momentum_index_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("IntradayMomentumIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_intraday_momentum_index_free(h);
return fails;
}
static int check_IntradayVolatilityProfile(void) {
struct IntradayVolatilityProfile *h = wickra_intraday_volatility_profile_new((uintptr_t)24, (int32_t)0);
if (!h) { printf("FAIL IntradayVolatilityProfile: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_IntradayVolatilityProfile", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double vbuf[256];
intptr_t k = wickra_intraday_volatility_profile_update(h, o, hi, lo, c, v, (int64_t)i, vbuf, 256);
if (k < 0) { for (int z = 0; z < 24; z++) got[gn++] = NANV; }
else { for (int z = 0; z < 24; z++) got[gn++] = vbuf[z]; }
fails += cmp_row("IntradayVolatilityProfile", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_intraday_volatility_profile_free(h);
return fails;
}
static int check_InverseFisherTransform(void) {
struct InverseFisherTransform *h = wickra_inverse_fisher_transform_new(2.0);
if (!h) { printf("FAIL InverseFisherTransform: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_InverseFisherTransform", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_inverse_fisher_transform_update(h, c);
fails += cmp_row("InverseFisherTransform", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_inverse_fisher_transform_free(h);
return fails;
}
static int check_InvertedHammer(void) {
struct InvertedHammer *h = wickra_inverted_hammer_new();
if (!h) { printf("FAIL InvertedHammer: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_InvertedHammer", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_inverted_hammer_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("InvertedHammer", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_inverted_hammer_free(h);
return fails;
}
static int check_JarqueBera(void) {
struct JarqueBera *h = wickra_jarque_bera_new((uintptr_t)14);
if (!h) { printf("FAIL JarqueBera: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_JarqueBera", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_jarque_bera_update(h, c);
fails += cmp_row("JarqueBera", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_jarque_bera_free(h);
return fails;
}
static int check_Jma(void) {
struct Jma *h = wickra_jma_new((uintptr_t)7, 0.0, 2.0);
if (!h) { printf("FAIL Jma: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Jma", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_jma_update(h, c);
fails += cmp_row("Jma", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_jma_free(h);
return fails;
}
static int check_JumpIndicator(void) {
struct JumpIndicator *h = wickra_jump_indicator_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL JumpIndicator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_JumpIndicator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_jump_indicator_update(h, c);
fails += cmp_row("JumpIndicator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_jump_indicator_free(h);
return fails;
}
static int check_KRatio(void) {
struct KRatio *h = wickra_k_ratio_new((uintptr_t)14);
if (!h) { printf("FAIL KRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_KRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_k_ratio_update(h, c);
fails += cmp_row("KRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_k_ratio_free(h);
return fails;
}
static int check_KagiBars(void) {
struct KagiBars *h = wickra_kagi_bars_new(2.0);
if (!h) { printf("FAIL KagiBars: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_KagiBars", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraKagiBar bbuf[256];
uintptr_t k = wickra_kagi_bars_update(h, c, c, c, c, 1.0, 0, bbuf, 256);
for (uintptr_t b = 0; b < (uintptr_t)k; b++) {
got[gn++] = (double)bbuf[b].start;
got[gn++] = (double)bbuf[b].end;
got[gn++] = (double)bbuf[b].direction;
}
fails += cmp_row("KagiBars", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_kagi_bars_free(h);
return fails;
}
static int check_KalmanHedgeRatio(void) {
struct KalmanHedgeRatio *h = wickra_kalman_hedge_ratio_new(0.01, 0.001);
if (!h) { printf("FAIL KalmanHedgeRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_KalmanHedgeRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraKalmanHedgeRatioOutput out;
if (wickra_kalman_hedge_ratio_update(h, c, o, &out)) {
got[gn++] = out.hedge_ratio;
got[gn++] = out.intercept;
got[gn++] = out.spread;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("KalmanHedgeRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_kalman_hedge_ratio_free(h);
return fails;
}
static int check_Kama(void) {
struct Kama *h = wickra_kama_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14);
if (!h) { printf("FAIL Kama: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Kama", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_kama_update(h, c);
fails += cmp_row("Kama", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_kama_free(h);
return fails;
}
static int check_KaseDevStop(void) {
struct KaseDevStop *h = wickra_kase_dev_stop_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL KaseDevStop: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_KaseDevStop", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraKaseDevStopOutput out;
if (wickra_kase_dev_stop_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.value;
got[gn++] = out.direction;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("KaseDevStop", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_kase_dev_stop_free(h);
return fails;
}
static int check_KasePermissionStochastic(void) {
struct KasePermissionStochastic *h = wickra_kase_permission_stochastic_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL KasePermissionStochastic: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_KasePermissionStochastic", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraKasePermissionStochasticOutput out;
if (wickra_kase_permission_stochastic_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.fast;
got[gn++] = out.slow;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("KasePermissionStochastic", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_kase_permission_stochastic_free(h);
return fails;
}
static int check_KellyCriterion(void) {
struct KellyCriterion *h = wickra_kelly_criterion_new((uintptr_t)14);
if (!h) { printf("FAIL KellyCriterion: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_KellyCriterion", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_kelly_criterion_update(h, c);
fails += cmp_row("KellyCriterion", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_kelly_criterion_free(h);
return fails;
}
static int check_Keltner(void) {
struct Keltner *h = wickra_keltner_new((uintptr_t)3, (uintptr_t)7, 2.0);
if (!h) { printf("FAIL Keltner: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Keltner", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraKeltnerOutput out;
if (wickra_keltner_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.upper;
got[gn++] = out.middle;
got[gn++] = out.lower;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("Keltner", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_keltner_free(h);
return fails;
}
static int check_KendallTau(void) {
struct KendallTau *h = wickra_kendall_tau_new((uintptr_t)14);
if (!h) { printf("FAIL KendallTau: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_KendallTau", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_kendall_tau_update(h, c, o);
fails += cmp_row("KendallTau", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_kendall_tau_free(h);
return fails;
}
static int check_Kicking(void) {
struct Kicking *h = wickra_kicking_new();
if (!h) { printf("FAIL Kicking: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Kicking", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_kicking_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Kicking", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_kicking_free(h);
return fails;
}
static int check_KickingByLength(void) {
struct KickingByLength *h = wickra_kicking_by_length_new();
if (!h) { printf("FAIL KickingByLength: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_KickingByLength", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_kicking_by_length_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("KickingByLength", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_kicking_by_length_free(h);
return fails;
}
static int check_Kst(void) {
struct Kst *h = wickra_kst_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14, (uintptr_t)28, (uintptr_t)35, (uintptr_t)42, (uintptr_t)56, (uintptr_t)63, (uintptr_t)70);
if (!h) { printf("FAIL Kst: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Kst", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraKstOutput out;
if (wickra_kst_update(h, c, &out)) {
got[gn++] = out.kst;
got[gn++] = out.signal;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("Kst", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_kst_free(h);
return fails;
}
static int check_Kurtosis(void) {
struct Kurtosis *h = wickra_kurtosis_new((uintptr_t)14);
if (!h) { printf("FAIL Kurtosis: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Kurtosis", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_kurtosis_update(h, c);
fails += cmp_row("Kurtosis", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_kurtosis_free(h);
return fails;
}
static int check_Kvo(void) {
struct Kvo *h = wickra_kvo_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL Kvo: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Kvo", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_kvo_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Kvo", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_kvo_free(h);
return fails;
}
static int check_KylesLambda(void) {
struct KylesLambda *h = wickra_kyles_lambda_new((uintptr_t)20);
if (!h) { printf("FAIL KylesLambda: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_KylesLambda", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_kyles_lambda_update(h, c, v, c >= o, (int64_t)i, (hi + lo) / 2.0);
fails += cmp_row("KylesLambda", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_kyles_lambda_free(h);
return fails;
}
static int check_LadderBottom(void) {
struct LadderBottom *h = wickra_ladder_bottom_new();
if (!h) { printf("FAIL LadderBottom: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_LadderBottom", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_ladder_bottom_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("LadderBottom", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ladder_bottom_free(h);
return fails;
}
static int check_LaguerreRsi(void) {
struct LaguerreRsi *h = wickra_laguerre_rsi_new(0.5);
if (!h) { printf("FAIL LaguerreRsi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_LaguerreRsi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_laguerre_rsi_update(h, c);
fails += cmp_row("LaguerreRsi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_laguerre_rsi_free(h);
return fails;
}
static int check_LeadLagCrossCorrelation(void) {
struct LeadLagCrossCorrelation *h = wickra_lead_lag_cross_correlation_new((uintptr_t)20, (uintptr_t)10);
if (!h) { printf("FAIL LeadLagCrossCorrelation: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_LeadLagCrossCorrelation", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraLeadLagCrossCorrelationOutput out;
if (wickra_lead_lag_cross_correlation_update(h, c, o, &out)) {
got[gn++] = out.lag;
got[gn++] = out.correlation;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("LeadLagCrossCorrelation", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_lead_lag_cross_correlation_free(h);
return fails;
}
static int check_LinRegAngle(void) {
struct LinRegAngle *h = wickra_lin_reg_angle_new((uintptr_t)14);
if (!h) { printf("FAIL LinRegAngle: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_LinRegAngle", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_lin_reg_angle_update(h, c);
fails += cmp_row("LinRegAngle", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_lin_reg_angle_free(h);
return fails;
}
static int check_LinRegChannel(void) {
struct LinRegChannel *h = wickra_lin_reg_channel_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL LinRegChannel: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_LinRegChannel", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraLinRegChannelOutput out;
if (wickra_lin_reg_channel_update(h, c, &out)) {
got[gn++] = out.upper;
got[gn++] = out.middle;
got[gn++] = out.lower;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("LinRegChannel", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_lin_reg_channel_free(h);
return fails;
}
static int check_LinRegIntercept(void) {
struct LinRegIntercept *h = wickra_lin_reg_intercept_new((uintptr_t)14);
if (!h) { printf("FAIL LinRegIntercept: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_LinRegIntercept", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_lin_reg_intercept_update(h, c);
fails += cmp_row("LinRegIntercept", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_lin_reg_intercept_free(h);
return fails;
}
static int check_LinRegSlope(void) {
struct LinRegSlope *h = wickra_lin_reg_slope_new((uintptr_t)14);
if (!h) { printf("FAIL LinRegSlope: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_LinRegSlope", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_lin_reg_slope_update(h, c);
fails += cmp_row("LinRegSlope", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_lin_reg_slope_free(h);
return fails;
}
static int check_LinearRegression(void) {
struct LinearRegression *h = wickra_linear_regression_new((uintptr_t)14);
if (!h) { printf("FAIL LinearRegression: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_LinearRegression", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_linear_regression_update(h, c);
fails += cmp_row("LinearRegression", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_linear_regression_free(h);
return fails;
}
static int check_LiquidationFeatures(void) {
struct LiquidationFeatures *h = wickra_liquidation_features_new();
if (!h) { printf("FAIL LiquidationFeatures: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_LiquidationFeatures", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo;
struct WickraLiquidationFeaturesOutput out;
if (wickra_liquidation_features_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i, &out)) {
got[gn++] = out.long_;
got[gn++] = out.short_;
got[gn++] = out.net;
got[gn++] = out.total;
got[gn++] = out.imbalance;
} else {
for (int z = 0; z < 5; z++) got[gn++] = NANV;
}
fails += cmp_row("LiquidationFeatures", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_liquidation_features_free(h);
return fails;
}
static int check_LogReturn(void) {
struct LogReturn *h = wickra_log_return_new((uintptr_t)14);
if (!h) { printf("FAIL LogReturn: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_LogReturn", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_log_return_update(h, c);
fails += cmp_row("LogReturn", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_log_return_free(h);
return fails;
}
static int check_LongLeggedDoji(void) {
struct LongLeggedDoji *h = wickra_long_legged_doji_new();
if (!h) { printf("FAIL LongLeggedDoji: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_LongLeggedDoji", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_long_legged_doji_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("LongLeggedDoji", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_long_legged_doji_free(h);
return fails;
}
static int check_LongLine(void) {
struct LongLine *h = wickra_long_line_new();
if (!h) { printf("FAIL LongLine: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_LongLine", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_long_line_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("LongLine", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_long_line_free(h);
return fails;
}
static int check_LongShortRatio(void) {
struct LongShortRatio *h = wickra_long_short_ratio_new();
if (!h) { printf("FAIL LongShortRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_LongShortRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo;
got[gn++] = wickra_long_short_ratio_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i);
fails += cmp_row("LongShortRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_long_short_ratio_free(h);
return fails;
}
static int check_M2Measure(void) {
struct M2Measure *h = wickra_m2_measure_new((uintptr_t)14, 2.0, 0.5);
if (!h) { printf("FAIL M2Measure: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_M2Measure", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_m2_measure_update(h, c);
fails += cmp_row("M2Measure", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_m2_measure_free(h);
return fails;
}
static int check_MaEnvelope(void) {
struct MaEnvelope *h = wickra_ma_envelope_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL MaEnvelope: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MaEnvelope", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraMaEnvelopeOutput out;
if (wickra_ma_envelope_update(h, c, &out)) {
got[gn++] = out.upper;
got[gn++] = out.middle;
got[gn++] = out.lower;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("MaEnvelope", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ma_envelope_free(h);
return fails;
}
static int check_MacdExt(void) {
struct MacdExt *h = wickra_macd_ext_new((uintptr_t)12, (uint8_t)0, (uintptr_t)26, (uint8_t)0, (uintptr_t)9, (uint8_t)0);
if (!h) { printf("FAIL MacdExt: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MacdExt", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraMacdOutput out;
if (wickra_macd_ext_update(h, c, &out)) {
got[gn++] = out.macd;
got[gn++] = out.signal;
got[gn++] = out.histogram;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("MacdExt", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_macd_ext_free(h);
return fails;
}
static int check_MacdFix(void) {
struct MacdFix *h = wickra_macd_fix_new((uintptr_t)9);
if (!h) { printf("FAIL MacdFix: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MacdFix", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraMacdOutput out;
if (wickra_macd_fix_update(h, c, &out)) {
got[gn++] = out.macd;
got[gn++] = out.signal;
got[gn++] = out.histogram;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("MacdFix", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_macd_fix_free(h);
return fails;
}
static int check_MacdHistogram(void) {
struct MacdHistogram *h = wickra_macd_histogram_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14);
if (!h) { printf("FAIL MacdHistogram: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MacdHistogram", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_macd_histogram_update(h, c);
fails += cmp_row("MacdHistogram", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_macd_histogram_free(h);
return fails;
}
static int check_MacdIndicator(void) {
struct MacdIndicator *h = wickra_macd_indicator_new((uintptr_t)12, (uintptr_t)26, (uintptr_t)9);
if (!h) { printf("FAIL MacdIndicator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MacdIndicator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraMacdOutput out;
if (wickra_macd_indicator_update(h, c, &out)) {
got[gn++] = out.macd;
got[gn++] = out.signal;
got[gn++] = out.histogram;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("MacdIndicator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_macd_indicator_free(h);
return fails;
}
static int check_Mama(void) {
struct Mama *h = wickra_mama_new(0.5, 0.05);
if (!h) { printf("FAIL Mama: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Mama", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraMamaOutput out;
if (wickra_mama_update(h, c, &out)) {
got[gn++] = out.mama;
got[gn++] = out.fama;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("Mama", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_mama_free(h);
return fails;
}
static int check_MarketFacilitationIndex(void) {
struct MarketFacilitationIndex *h = wickra_market_facilitation_index_new();
if (!h) { printf("FAIL MarketFacilitationIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MarketFacilitationIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_market_facilitation_index_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("MarketFacilitationIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_market_facilitation_index_free(h);
return fails;
}
static int check_MartinRatio(void) {
struct MartinRatio *h = wickra_martin_ratio_new((uintptr_t)14);
if (!h) { printf("FAIL MartinRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MartinRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_martin_ratio_update(h, c);
fails += cmp_row("MartinRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_martin_ratio_free(h);
return fails;
}
static int check_Marubozu(void) {
struct Marubozu *h = wickra_marubozu_new();
if (!h) { printf("FAIL Marubozu: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Marubozu", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_marubozu_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Marubozu", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_marubozu_free(h);
return fails;
}
static int check_MassIndex(void) {
struct MassIndex *h = wickra_mass_index_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL MassIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MassIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_mass_index_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("MassIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_mass_index_free(h);
return fails;
}
static int check_MatHold(void) {
struct MatHold *h = wickra_mat_hold_new();
if (!h) { printf("FAIL MatHold: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MatHold", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_mat_hold_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("MatHold", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_mat_hold_free(h);
return fails;
}
static int check_MatchingLow(void) {
struct MatchingLow *h = wickra_matching_low_new();
if (!h) { printf("FAIL MatchingLow: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MatchingLow", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_matching_low_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("MatchingLow", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_matching_low_free(h);
return fails;
}
static int check_MaxDrawdown(void) {
struct MaxDrawdown *h = wickra_max_drawdown_new((uintptr_t)14);
if (!h) { printf("FAIL MaxDrawdown: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MaxDrawdown", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_max_drawdown_update(h, c);
fails += cmp_row("MaxDrawdown", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_max_drawdown_free(h);
return fails;
}
static int check_McClellanOscillator(void) {
struct McClellanOscillator *h = wickra_mc_clellan_oscillator_new();
if (!h) { printf("FAIL McClellanOscillator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_McClellanOscillator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5];
for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); }
got[gn++] = wickra_mc_clellan_oscillator_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i);
fails += cmp_row("McClellanOscillator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_mc_clellan_oscillator_free(h);
return fails;
}
static int check_McClellanSummationIndex(void) {
struct McClellanSummationIndex *h = wickra_mc_clellan_summation_index_new();
if (!h) { printf("FAIL McClellanSummationIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_McClellanSummationIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5];
for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); }
got[gn++] = wickra_mc_clellan_summation_index_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i);
fails += cmp_row("McClellanSummationIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_mc_clellan_summation_index_free(h);
return fails;
}
static int check_McGinleyDynamic(void) {
struct McGinleyDynamic *h = wickra_mc_ginley_dynamic_new((uintptr_t)14);
if (!h) { printf("FAIL McGinleyDynamic: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_McGinleyDynamic", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_mc_ginley_dynamic_update(h, c);
fails += cmp_row("McGinleyDynamic", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_mc_ginley_dynamic_free(h);
return fails;
}
static int check_MedianAbsoluteDeviation(void) {
struct MedianAbsoluteDeviation *h = wickra_median_absolute_deviation_new((uintptr_t)14);
if (!h) { printf("FAIL MedianAbsoluteDeviation: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MedianAbsoluteDeviation", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_median_absolute_deviation_update(h, c);
fails += cmp_row("MedianAbsoluteDeviation", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_median_absolute_deviation_free(h);
return fails;
}
static int check_MedianChannel(void) {
struct MedianChannel *h = wickra_median_channel_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL MedianChannel: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MedianChannel", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraMedianChannelOutput out;
if (wickra_median_channel_update(h, c, &out)) {
got[gn++] = out.upper;
got[gn++] = out.middle;
got[gn++] = out.lower;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("MedianChannel", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_median_channel_free(h);
return fails;
}
static int check_MedianMa(void) {
struct MedianMa *h = wickra_median_ma_new((uintptr_t)14);
if (!h) { printf("FAIL MedianMa: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MedianMa", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_median_ma_update(h, c);
fails += cmp_row("MedianMa", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_median_ma_free(h);
return fails;
}
static int check_MedianPrice(void) {
struct MedianPrice *h = wickra_median_price_new();
if (!h) { printf("FAIL MedianPrice: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MedianPrice", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_median_price_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("MedianPrice", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_median_price_free(h);
return fails;
}
static int check_Mfi(void) {
struct Mfi *h = wickra_mfi_new((uintptr_t)14);
if (!h) { printf("FAIL Mfi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Mfi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_mfi_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Mfi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_mfi_free(h);
return fails;
}
static int check_Microprice(void) {
struct Microprice *h = wickra_microprice_new();
if (!h) { printf("FAIL Microprice: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Microprice", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double bp[5], bs[5], ap[5], asz[5];
for (int k = 0; k < 5; k++) { double kf = k + 1; bp[k] = c - 0.1*kf; bs[k] = v/kf; ap[k] = c + 0.1*kf; asz[k] = v*0.9/kf; }
got[gn++] = wickra_microprice_update(h, bp, bs, 5, ap, asz, 5);
fails += cmp_row("Microprice", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_microprice_free(h);
return fails;
}
static int check_MidPoint(void) {
struct MidPoint *h = wickra_mid_point_new((uintptr_t)14);
if (!h) { printf("FAIL MidPoint: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MidPoint", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_mid_point_update(h, c);
fails += cmp_row("MidPoint", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_mid_point_free(h);
return fails;
}
static int check_MidPrice(void) {
struct MidPrice *h = wickra_mid_price_new((uintptr_t)14);
if (!h) { printf("FAIL MidPrice: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MidPrice", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_mid_price_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("MidPrice", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_mid_price_free(h);
return fails;
}
static int check_MinusDi(void) {
struct MinusDi *h = wickra_minus_di_new((uintptr_t)14);
if (!h) { printf("FAIL MinusDi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MinusDi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_minus_di_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("MinusDi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_minus_di_free(h);
return fails;
}
static int check_MinusDm(void) {
struct MinusDm *h = wickra_minus_dm_new((uintptr_t)14);
if (!h) { printf("FAIL MinusDm: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MinusDm", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_minus_dm_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("MinusDm", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_minus_dm_free(h);
return fails;
}
static int check_ModifiedMaStop(void) {
struct ModifiedMaStop *h = wickra_modified_ma_stop_new((uintptr_t)14);
if (!h) { printf("FAIL ModifiedMaStop: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ModifiedMaStop", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraModifiedMaStopOutput out;
if (wickra_modified_ma_stop_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.value;
got[gn++] = out.direction;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("ModifiedMaStop", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_modified_ma_stop_free(h);
return fails;
}
static int check_Mom(void) {
struct Mom *h = wickra_mom_new((uintptr_t)14);
if (!h) { printf("FAIL Mom: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Mom", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_mom_update(h, c);
fails += cmp_row("Mom", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_mom_free(h);
return fails;
}
static int check_MorningDojiStar(void) {
struct MorningDojiStar *h = wickra_morning_doji_star_new();
if (!h) { printf("FAIL MorningDojiStar: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MorningDojiStar", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_morning_doji_star_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("MorningDojiStar", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_morning_doji_star_free(h);
return fails;
}
static int check_MorningEveningStar(void) {
struct MorningEveningStar *h = wickra_morning_evening_star_new();
if (!h) { printf("FAIL MorningEveningStar: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MorningEveningStar", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_morning_evening_star_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("MorningEveningStar", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_morning_evening_star_free(h);
return fails;
}
static int check_MurreyMathLines(void) {
struct MurreyMathLines *h = wickra_murrey_math_lines_new((uintptr_t)14);
if (!h) { printf("FAIL MurreyMathLines: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_MurreyMathLines", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraMurreyMathLinesOutput out;
if (wickra_murrey_math_lines_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.mm8_8;
got[gn++] = out.mm7_8;
got[gn++] = out.mm6_8;
got[gn++] = out.mm5_8;
got[gn++] = out.mm4_8;
got[gn++] = out.mm3_8;
got[gn++] = out.mm2_8;
got[gn++] = out.mm1_8;
got[gn++] = out.mm0_8;
} else {
for (int z = 0; z < 9; z++) got[gn++] = NANV;
}
fails += cmp_row("MurreyMathLines", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_murrey_math_lines_free(h);
return fails;
}
static int check_NakedPoc(void) {
struct NakedPoc *h = wickra_naked_poc_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL NakedPoc: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_NakedPoc", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_naked_poc_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("NakedPoc", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_naked_poc_free(h);
return fails;
}
static int check_Natr(void) {
struct Natr *h = wickra_natr_new((uintptr_t)14);
if (!h) { printf("FAIL Natr: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Natr", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_natr_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Natr", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_natr_free(h);
return fails;
}
static int check_NewHighsNewLows(void) {
struct NewHighsNewLows *h = wickra_new_highs_new_lows_new();
if (!h) { printf("FAIL NewHighsNewLows: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_NewHighsNewLows", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5];
for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); }
got[gn++] = wickra_new_highs_new_lows_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i);
fails += cmp_row("NewHighsNewLows", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_new_highs_new_lows_free(h);
return fails;
}
static int check_NewPriceLines(void) {
struct NewPriceLines *h = wickra_new_price_lines_new((uintptr_t)14);
if (!h) { printf("FAIL NewPriceLines: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_NewPriceLines", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_new_price_lines_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("NewPriceLines", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_new_price_lines_free(h);
return fails;
}
static int check_Nrtr(void) {
struct Nrtr *h = wickra_nrtr_new(2.0);
if (!h) { printf("FAIL Nrtr: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Nrtr", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraNrtrOutput out;
if (wickra_nrtr_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.value;
got[gn++] = out.direction;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("Nrtr", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_nrtr_free(h);
return fails;
}
static int check_Nvi(void) {
struct Nvi *h = wickra_nvi_new();
if (!h) { printf("FAIL Nvi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Nvi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_nvi_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Nvi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_nvi_free(h);
return fails;
}
static int check_OIPriceDivergence(void) {
struct OIPriceDivergence *h = wickra_oi_price_divergence_new((uintptr_t)20);
if (!h) { printf("FAIL OIPriceDivergence: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_OIPriceDivergence", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo;
got[gn++] = wickra_oi_price_divergence_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i);
fails += cmp_row("OIPriceDivergence", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_oi_price_divergence_free(h);
return fails;
}
static int check_OIWeighted(void) {
struct OIWeighted *h = wickra_oi_weighted_new();
if (!h) { printf("FAIL OIWeighted: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_OIWeighted", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo;
got[gn++] = wickra_oi_weighted_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i);
fails += cmp_row("OIWeighted", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_oi_weighted_free(h);
return fails;
}
static int check_Obv(void) {
struct Obv *h = wickra_obv_new();
if (!h) { printf("FAIL Obv: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Obv", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_obv_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Obv", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_obv_free(h);
return fails;
}
static int check_OiToVolumeRatio(void) {
struct OiToVolumeRatio *h = wickra_oi_to_volume_ratio_new();
if (!h) { printf("FAIL OiToVolumeRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_OiToVolumeRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo;
got[gn++] = wickra_oi_to_volume_ratio_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i);
fails += cmp_row("OiToVolumeRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_oi_to_volume_ratio_free(h);
return fails;
}
static int check_OmegaRatio(void) {
struct OmegaRatio *h = wickra_omega_ratio_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL OmegaRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_OmegaRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_omega_ratio_update(h, c);
fails += cmp_row("OmegaRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_omega_ratio_free(h);
return fails;
}
static int check_OnNeck(void) {
struct OnNeck *h = wickra_on_neck_new();
if (!h) { printf("FAIL OnNeck: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_OnNeck", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_on_neck_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("OnNeck", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_on_neck_free(h);
return fails;
}
static int check_OpenInterestDelta(void) {
struct OpenInterestDelta *h = wickra_open_interest_delta_new();
if (!h) { printf("FAIL OpenInterestDelta: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_OpenInterestDelta", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo;
got[gn++] = wickra_open_interest_delta_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i);
fails += cmp_row("OpenInterestDelta", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_open_interest_delta_free(h);
return fails;
}
static int check_OpenInterestMomentum(void) {
struct OpenInterestMomentum *h = wickra_open_interest_momentum_new((uintptr_t)10);
if (!h) { printf("FAIL OpenInterestMomentum: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_OpenInterestMomentum", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo;
got[gn++] = wickra_open_interest_momentum_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i);
fails += cmp_row("OpenInterestMomentum", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_open_interest_momentum_free(h);
return fails;
}
static int check_OpeningMarubozu(void) {
struct OpeningMarubozu *h = wickra_opening_marubozu_new();
if (!h) { printf("FAIL OpeningMarubozu: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_OpeningMarubozu", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_opening_marubozu_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("OpeningMarubozu", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_opening_marubozu_free(h);
return fails;
}
static int check_OpeningRange(void) {
struct OpeningRange *h = wickra_opening_range_new((uintptr_t)14);
if (!h) { printf("FAIL OpeningRange: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_OpeningRange", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraOpeningRangeOutput out;
if (wickra_opening_range_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.high;
got[gn++] = out.low;
got[gn++] = out.breakout_distance;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("OpeningRange", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_opening_range_free(h);
return fails;
}
static int check_OrderBookImbalanceFull(void) {
struct OrderBookImbalanceFull *h = wickra_order_book_imbalance_full_new();
if (!h) { printf("FAIL OrderBookImbalanceFull: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_OrderBookImbalanceFull", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double bp[5], bs[5], ap[5], asz[5];
for (int k = 0; k < 5; k++) { double kf = k + 1; bp[k] = c - 0.1*kf; bs[k] = v/kf; ap[k] = c + 0.1*kf; asz[k] = v*0.9/kf; }
got[gn++] = wickra_order_book_imbalance_full_update(h, bp, bs, 5, ap, asz, 5);
fails += cmp_row("OrderBookImbalanceFull", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_order_book_imbalance_full_free(h);
return fails;
}
static int check_OrderBookImbalanceTop1(void) {
struct OrderBookImbalanceTop1 *h = wickra_order_book_imbalance_top1_new();
if (!h) { printf("FAIL OrderBookImbalanceTop1: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_OrderBookImbalanceTop1", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double bp[5], bs[5], ap[5], asz[5];
for (int k = 0; k < 5; k++) { double kf = k + 1; bp[k] = c - 0.1*kf; bs[k] = v/kf; ap[k] = c + 0.1*kf; asz[k] = v*0.9/kf; }
got[gn++] = wickra_order_book_imbalance_top1_update(h, bp, bs, 5, ap, asz, 5);
fails += cmp_row("OrderBookImbalanceTop1", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_order_book_imbalance_top1_free(h);
return fails;
}
static int check_OrderBookImbalanceTopN(void) {
struct OrderBookImbalanceTopN *h = wickra_order_book_imbalance_top_n_new((uintptr_t)5);
if (!h) { printf("FAIL OrderBookImbalanceTopN: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_OrderBookImbalanceTopN", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double bp[5], bs[5], ap[5], asz[5];
for (int k = 0; k < 5; k++) { double kf = k + 1; bp[k] = c - 0.1*kf; bs[k] = v/kf; ap[k] = c + 0.1*kf; asz[k] = v*0.9/kf; }
got[gn++] = wickra_order_book_imbalance_top_n_update(h, bp, bs, 5, ap, asz, 5);
fails += cmp_row("OrderBookImbalanceTopN", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_order_book_imbalance_top_n_free(h);
return fails;
}
static int check_OrderFlowImbalance(void) {
struct OrderFlowImbalance *h = wickra_order_flow_imbalance_new((uintptr_t)20);
if (!h) { printf("FAIL OrderFlowImbalance: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_OrderFlowImbalance", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double bp[5], bs[5], ap[5], asz[5];
for (int k = 0; k < 5; k++) { double kf = k + 1; bp[k] = c - 0.1*kf; bs[k] = v/kf; ap[k] = c + 0.1*kf; asz[k] = v*0.9/kf; }
got[gn++] = wickra_order_flow_imbalance_update(h, bp, bs, 5, ap, asz, 5);
fails += cmp_row("OrderFlowImbalance", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_order_flow_imbalance_free(h);
return fails;
}
static int check_OuHalfLife(void) {
struct OuHalfLife *h = wickra_ou_half_life_new((uintptr_t)14);
if (!h) { printf("FAIL OuHalfLife: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_OuHalfLife", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_ou_half_life_update(h, c, o);
fails += cmp_row("OuHalfLife", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ou_half_life_free(h);
return fails;
}
static int check_OvernightGap(void) {
struct OvernightGap *h = wickra_overnight_gap_new((int32_t)0);
if (!h) { printf("FAIL OvernightGap: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_OvernightGap", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_overnight_gap_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("OvernightGap", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_overnight_gap_free(h);
return fails;
}
static int check_OvernightIntradayReturn(void) {
struct OvernightIntradayReturn *h = wickra_overnight_intraday_return_new((int32_t)14);
if (!h) { printf("FAIL OvernightIntradayReturn: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_OvernightIntradayReturn", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraOvernightIntradayReturnOutput out;
if (wickra_overnight_intraday_return_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.overnight;
got[gn++] = out.intraday;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("OvernightIntradayReturn", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_overnight_intraday_return_free(h);
return fails;
}
static int check_PainIndex(void) {
struct PainIndex *h = wickra_pain_index_new((uintptr_t)14);
if (!h) { printf("FAIL PainIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_PainIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_pain_index_update(h, c);
fails += cmp_row("PainIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_pain_index_free(h);
return fails;
}
static int check_PairSpreadZScore(void) {
struct PairSpreadZScore *h = wickra_pair_spread_z_score_new((uintptr_t)20, (uintptr_t)20);
if (!h) { printf("FAIL PairSpreadZScore: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_PairSpreadZScore", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_pair_spread_z_score_update(h, c, o);
fails += cmp_row("PairSpreadZScore", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_pair_spread_z_score_free(h);
return fails;
}
static int check_PairwiseBeta(void) {
struct PairwiseBeta *h = wickra_pairwise_beta_new((uintptr_t)14);
if (!h) { printf("FAIL PairwiseBeta: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_PairwiseBeta", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_pairwise_beta_update(h, c, o);
fails += cmp_row("PairwiseBeta", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_pairwise_beta_free(h);
return fails;
}
static int check_ParkinsonVolatility(void) {
struct ParkinsonVolatility *h = wickra_parkinson_volatility_new((uintptr_t)20, (uintptr_t)252);
if (!h) { printf("FAIL ParkinsonVolatility: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ParkinsonVolatility", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_parkinson_volatility_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ParkinsonVolatility", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_parkinson_volatility_free(h);
return fails;
}
static int check_PearsonCorrelation(void) {
struct PearsonCorrelation *h = wickra_pearson_correlation_new((uintptr_t)14);
if (!h) { printf("FAIL PearsonCorrelation: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_PearsonCorrelation", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_pearson_correlation_update(h, c, o);
fails += cmp_row("PearsonCorrelation", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_pearson_correlation_free(h);
return fails;
}
static int check_PercentAboveMa(void) {
struct PercentAboveMa *h = wickra_percent_above_ma_new();
if (!h) { printf("FAIL PercentAboveMa: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_PercentAboveMa", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5];
for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); }
got[gn++] = wickra_percent_above_ma_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i);
fails += cmp_row("PercentAboveMa", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_percent_above_ma_free(h);
return fails;
}
static int check_PercentB(void) {
struct PercentB *h = wickra_percent_b_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL PercentB: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_PercentB", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_percent_b_update(h, c);
fails += cmp_row("PercentB", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_percent_b_free(h);
return fails;
}
static int check_PercentageTrailingStop(void) {
struct PercentageTrailingStop *h = wickra_percentage_trailing_stop_new(2.0);
if (!h) { printf("FAIL PercentageTrailingStop: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_PercentageTrailingStop", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_percentage_trailing_stop_update(h, c);
fails += cmp_row("PercentageTrailingStop", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_percentage_trailing_stop_free(h);
return fails;
}
static int check_PerpetualPremiumIndex(void) {
struct PerpetualPremiumIndex *h = wickra_perpetual_premium_index_new();
if (!h) { printf("FAIL PerpetualPremiumIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_PerpetualPremiumIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo;
got[gn++] = wickra_perpetual_premium_index_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i);
fails += cmp_row("PerpetualPremiumIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_perpetual_premium_index_free(h);
return fails;
}
static int check_Pgo(void) {
struct Pgo *h = wickra_pgo_new((uintptr_t)14);
if (!h) { printf("FAIL Pgo: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Pgo", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_pgo_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Pgo", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_pgo_free(h);
return fails;
}
static int check_PiercingDarkCloud(void) {
struct PiercingDarkCloud *h = wickra_piercing_dark_cloud_new();
if (!h) { printf("FAIL PiercingDarkCloud: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_PiercingDarkCloud", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_piercing_dark_cloud_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("PiercingDarkCloud", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_piercing_dark_cloud_free(h);
return fails;
}
static int check_Pin(void) {
struct Pin *h = wickra_pin_new((uintptr_t)20);
if (!h) { printf("FAIL Pin: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Pin", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_pin_update(h, c, v, c >= o, (int64_t)i);
fails += cmp_row("Pin", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_pin_free(h);
return fails;
}
static int check_PivotReversal(void) {
struct PivotReversal *h = wickra_pivot_reversal_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL PivotReversal: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_PivotReversal", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_pivot_reversal_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("PivotReversal", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_pivot_reversal_free(h);
return fails;
}
static int check_PlusDi(void) {
struct PlusDi *h = wickra_plus_di_new((uintptr_t)14);
if (!h) { printf("FAIL PlusDi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_PlusDi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_plus_di_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("PlusDi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_plus_di_free(h);
return fails;
}
static int check_PlusDm(void) {
struct PlusDm *h = wickra_plus_dm_new((uintptr_t)14);
if (!h) { printf("FAIL PlusDm: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_PlusDm", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_plus_dm_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("PlusDm", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_plus_dm_free(h);
return fails;
}
static int check_Pmo(void) {
struct Pmo *h = wickra_pmo_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL Pmo: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Pmo", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_pmo_update(h, c);
fails += cmp_row("Pmo", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_pmo_free(h);
return fails;
}
static int check_PointAndFigureBars(void) {
struct PointAndFigureBars *h = wickra_point_and_figure_bars_new(2.0, (uintptr_t)3);
if (!h) { printf("FAIL PointAndFigureBars: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_PointAndFigureBars", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraPnfColumn bbuf[256];
uintptr_t k = wickra_point_and_figure_bars_update(h, c, c, c, c, 1.0, 0, bbuf, 256);
for (uintptr_t b = 0; b < (uintptr_t)k; b++) {
got[gn++] = (double)bbuf[b].direction;
got[gn++] = (double)bbuf[b].high;
got[gn++] = (double)bbuf[b].low;
}
fails += cmp_row("PointAndFigureBars", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_point_and_figure_bars_free(h);
return fails;
}
static int check_PolarizedFractalEfficiency(void) {
struct PolarizedFractalEfficiency *h = wickra_polarized_fractal_efficiency_new((uintptr_t)10, (uintptr_t)5);
if (!h) { printf("FAIL PolarizedFractalEfficiency: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_PolarizedFractalEfficiency", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_polarized_fractal_efficiency_update(h, c);
fails += cmp_row("PolarizedFractalEfficiency", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_polarized_fractal_efficiency_free(h);
return fails;
}
static int check_Ppo(void) {
struct Ppo *h = wickra_ppo_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL Ppo: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Ppo", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_ppo_update(h, c);
fails += cmp_row("Ppo", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ppo_free(h);
return fails;
}
static int check_PpoHistogram(void) {
struct PpoHistogram *h = wickra_ppo_histogram_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14);
if (!h) { printf("FAIL PpoHistogram: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_PpoHistogram", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_ppo_histogram_update(h, c);
fails += cmp_row("PpoHistogram", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ppo_histogram_free(h);
return fails;
}
static int check_ProfileShape(void) {
struct ProfileShape *h = wickra_profile_shape_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL ProfileShape: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ProfileShape", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_profile_shape_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ProfileShape", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_profile_shape_free(h);
return fails;
}
static int check_ProfitFactor(void) {
struct ProfitFactor *h = wickra_profit_factor_new((uintptr_t)14);
if (!h) { printf("FAIL ProfitFactor: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ProfitFactor", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_profit_factor_update(h, c);
fails += cmp_row("ProfitFactor", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_profit_factor_free(h);
return fails;
}
static int check_ProjectionBands(void) {
struct ProjectionBands *h = wickra_projection_bands_new((uintptr_t)14);
if (!h) { printf("FAIL ProjectionBands: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ProjectionBands", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraProjectionBandsOutput out;
if (wickra_projection_bands_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.upper;
got[gn++] = out.middle;
got[gn++] = out.lower;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("ProjectionBands", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_projection_bands_free(h);
return fails;
}
static int check_ProjectionOscillator(void) {
struct ProjectionOscillator *h = wickra_projection_oscillator_new((uintptr_t)14);
if (!h) { printf("FAIL ProjectionOscillator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ProjectionOscillator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_projection_oscillator_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ProjectionOscillator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_projection_oscillator_free(h);
return fails;
}
static int check_Psar(void) {
struct Psar *h = wickra_psar_new(0.02, 0.02, 0.2);
if (!h) { printf("FAIL Psar: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Psar", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_psar_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Psar", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_psar_free(h);
return fails;
}
static int check_Pvi(void) {
struct Pvi *h = wickra_pvi_new();
if (!h) { printf("FAIL Pvi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Pvi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_pvi_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Pvi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_pvi_free(h);
return fails;
}
static int check_Qqe(void) {
struct Qqe *h = wickra_qqe_new((uintptr_t)3, (uintptr_t)7, 2.0);
if (!h) { printf("FAIL Qqe: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Qqe", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraQqeOutput out;
if (wickra_qqe_update(h, c, &out)) {
got[gn++] = out.rsi_ma;
got[gn++] = out.trailing_line;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("Qqe", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_qqe_free(h);
return fails;
}
static int check_Qstick(void) {
struct Qstick *h = wickra_qstick_new((uintptr_t)14);
if (!h) { printf("FAIL Qstick: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Qstick", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_qstick_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Qstick", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_qstick_free(h);
return fails;
}
static int check_QuartileBands(void) {
struct QuartileBands *h = wickra_quartile_bands_new((uintptr_t)14);
if (!h) { printf("FAIL QuartileBands: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_QuartileBands", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraQuartileBandsOutput out;
if (wickra_quartile_bands_update(h, c, &out)) {
got[gn++] = out.upper;
got[gn++] = out.middle;
got[gn++] = out.lower;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("QuartileBands", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_quartile_bands_free(h);
return fails;
}
static int check_QuotedSpread(void) {
struct QuotedSpread *h = wickra_quoted_spread_new();
if (!h) { printf("FAIL QuotedSpread: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_QuotedSpread", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double bp[5], bs[5], ap[5], asz[5];
for (int k = 0; k < 5; k++) { double kf = k + 1; bp[k] = c - 0.1*kf; bs[k] = v/kf; ap[k] = c + 0.1*kf; asz[k] = v*0.9/kf; }
got[gn++] = wickra_quoted_spread_update(h, bp, bs, 5, ap, asz, 5);
fails += cmp_row("QuotedSpread", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_quoted_spread_free(h);
return fails;
}
static int check_RSquared(void) {
struct RSquared *h = wickra_r_squared_new((uintptr_t)14);
if (!h) { printf("FAIL RSquared: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RSquared", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_r_squared_update(h, c);
fails += cmp_row("RSquared", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_r_squared_free(h);
return fails;
}
static int check_RangeBars(void) {
struct RangeBars *h = wickra_range_bars_new(2.0);
if (!h) { printf("FAIL RangeBars: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RangeBars", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraRangeBar bbuf[256];
uintptr_t k = wickra_range_bars_update(h, c, c, c, c, 1.0, 0, bbuf, 256);
for (uintptr_t b = 0; b < (uintptr_t)k; b++) {
got[gn++] = (double)bbuf[b].open;
got[gn++] = (double)bbuf[b].close;
got[gn++] = (double)bbuf[b].direction;
}
fails += cmp_row("RangeBars", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_range_bars_free(h);
return fails;
}
static int check_RealizedSpread(void) {
struct RealizedSpread *h = wickra_realized_spread_new((uintptr_t)20);
if (!h) { printf("FAIL RealizedSpread: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RealizedSpread", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_realized_spread_update(h, c, v, c >= o, (int64_t)i, (hi + lo) / 2.0);
fails += cmp_row("RealizedSpread", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_realized_spread_free(h);
return fails;
}
static int check_RealizedVolatility(void) {
struct RealizedVolatility *h = wickra_realized_volatility_new((uintptr_t)14);
if (!h) { printf("FAIL RealizedVolatility: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RealizedVolatility", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_realized_volatility_update(h, c);
fails += cmp_row("RealizedVolatility", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_realized_volatility_free(h);
return fails;
}
static int check_RecoveryFactor(void) {
struct RecoveryFactor *h = wickra_recovery_factor_new();
if (!h) { printf("FAIL RecoveryFactor: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RecoveryFactor", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_recovery_factor_update(h, c);
fails += cmp_row("RecoveryFactor", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_recovery_factor_free(h);
return fails;
}
static int check_RectangleRange(void) {
struct RectangleRange *h = wickra_rectangle_range_new();
if (!h) { printf("FAIL RectangleRange: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RectangleRange", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rectangle_range_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("RectangleRange", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rectangle_range_free(h);
return fails;
}
static int check_Reflex(void) {
struct Reflex *h = wickra_reflex_new((uintptr_t)14);
if (!h) { printf("FAIL Reflex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Reflex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_reflex_update(h, c);
fails += cmp_row("Reflex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_reflex_free(h);
return fails;
}
static int check_RegimeLabel(void) {
struct RegimeLabel *h = wickra_regime_label_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL RegimeLabel: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RegimeLabel", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_regime_label_update(h, c);
fails += cmp_row("RegimeLabel", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_regime_label_free(h);
return fails;
}
static int check_RelativeStrengthAB(void) {
struct RelativeStrengthAB *h = wickra_relative_strength_ab_new((uintptr_t)14, (uintptr_t)14);
if (!h) { printf("FAIL RelativeStrengthAB: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RelativeStrengthAB", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraRelativeStrengthOutput out;
if (wickra_relative_strength_ab_update(h, c, o, &out)) {
got[gn++] = out.ratio;
got[gn++] = out.ratio_ma;
got[gn++] = out.ratio_rsi;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("RelativeStrengthAB", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_relative_strength_ab_free(h);
return fails;
}
static int check_RenkoBars(void) {
struct RenkoBars *h = wickra_renko_bars_new(2.0);
if (!h) { printf("FAIL RenkoBars: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RenkoBars", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraRenkoBrick bbuf[256];
uintptr_t k = wickra_renko_bars_update(h, c, c, c, c, 1.0, 0, bbuf, 256);
for (uintptr_t b = 0; b < (uintptr_t)k; b++) {
got[gn++] = (double)bbuf[b].open;
got[gn++] = (double)bbuf[b].close;
got[gn++] = (double)bbuf[b].direction;
}
fails += cmp_row("RenkoBars", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_renko_bars_free(h);
return fails;
}
static int check_RenkoTrailingStop(void) {
struct RenkoTrailingStop *h = wickra_renko_trailing_stop_new(2.0);
if (!h) { printf("FAIL RenkoTrailingStop: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RenkoTrailingStop", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_renko_trailing_stop_update(h, c);
fails += cmp_row("RenkoTrailingStop", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_renko_trailing_stop_free(h);
return fails;
}
static int check_RickshawMan(void) {
struct RickshawMan *h = wickra_rickshaw_man_new();
if (!h) { printf("FAIL RickshawMan: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RickshawMan", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rickshaw_man_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("RickshawMan", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rickshaw_man_free(h);
return fails;
}
static int check_RisingThreeMethods(void) {
struct RisingThreeMethods *h = wickra_rising_three_methods_new();
if (!h) { printf("FAIL RisingThreeMethods: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RisingThreeMethods", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rising_three_methods_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("RisingThreeMethods", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rising_three_methods_free(h);
return fails;
}
static int check_Rmi(void) {
struct Rmi *h = wickra_rmi_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL Rmi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Rmi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rmi_update(h, c);
fails += cmp_row("Rmi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rmi_free(h);
return fails;
}
static int check_Roc(void) {
struct Roc *h = wickra_roc_new((uintptr_t)14);
if (!h) { printf("FAIL Roc: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Roc", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_roc_update(h, c);
fails += cmp_row("Roc", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_roc_free(h);
return fails;
}
static int check_Rocp(void) {
struct Rocp *h = wickra_rocp_new((uintptr_t)14);
if (!h) { printf("FAIL Rocp: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Rocp", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rocp_update(h, c);
fails += cmp_row("Rocp", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rocp_free(h);
return fails;
}
static int check_Rocr(void) {
struct Rocr *h = wickra_rocr_new((uintptr_t)14);
if (!h) { printf("FAIL Rocr: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Rocr", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rocr_update(h, c);
fails += cmp_row("Rocr", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rocr_free(h);
return fails;
}
static int check_Rocr100(void) {
struct Rocr100 *h = wickra_rocr100_new((uintptr_t)14);
if (!h) { printf("FAIL Rocr100: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Rocr100", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rocr100_update(h, c);
fails += cmp_row("Rocr100", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rocr100_free(h);
return fails;
}
static int check_RogersSatchellVolatility(void) {
struct RogersSatchellVolatility *h = wickra_rogers_satchell_volatility_new((uintptr_t)20, (uintptr_t)252);
if (!h) { printf("FAIL RogersSatchellVolatility: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RogersSatchellVolatility", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rogers_satchell_volatility_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("RogersSatchellVolatility", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rogers_satchell_volatility_free(h);
return fails;
}
static int check_RollMeasure(void) {
struct RollMeasure *h = wickra_roll_measure_new((uintptr_t)20);
if (!h) { printf("FAIL RollMeasure: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RollMeasure", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_roll_measure_update(h, c, v, c >= o, (int64_t)i);
fails += cmp_row("RollMeasure", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_roll_measure_free(h);
return fails;
}
static int check_RollingCorrelation(void) {
struct RollingCorrelation *h = wickra_rolling_correlation_new((uintptr_t)14);
if (!h) { printf("FAIL RollingCorrelation: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RollingCorrelation", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rolling_correlation_update(h, c, o);
fails += cmp_row("RollingCorrelation", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rolling_correlation_free(h);
return fails;
}
static int check_RollingCovariance(void) {
struct RollingCovariance *h = wickra_rolling_covariance_new((uintptr_t)14);
if (!h) { printf("FAIL RollingCovariance: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RollingCovariance", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rolling_covariance_update(h, c, o);
fails += cmp_row("RollingCovariance", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rolling_covariance_free(h);
return fails;
}
static int check_RollingIqr(void) {
struct RollingIqr *h = wickra_rolling_iqr_new((uintptr_t)14);
if (!h) { printf("FAIL RollingIqr: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RollingIqr", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rolling_iqr_update(h, c);
fails += cmp_row("RollingIqr", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rolling_iqr_free(h);
return fails;
}
static int check_RollingMinMaxScaler(void) {
struct RollingMinMaxScaler *h = wickra_rolling_min_max_scaler_new((uintptr_t)14);
if (!h) { printf("FAIL RollingMinMaxScaler: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RollingMinMaxScaler", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rolling_min_max_scaler_update(h, c);
fails += cmp_row("RollingMinMaxScaler", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rolling_min_max_scaler_free(h);
return fails;
}
static int check_RollingPercentileRank(void) {
struct RollingPercentileRank *h = wickra_rolling_percentile_rank_new((uintptr_t)14);
if (!h) { printf("FAIL RollingPercentileRank: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RollingPercentileRank", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rolling_percentile_rank_update(h, c);
fails += cmp_row("RollingPercentileRank", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rolling_percentile_rank_free(h);
return fails;
}
static int check_RollingQuantile(void) {
struct RollingQuantile *h = wickra_rolling_quantile_new((uintptr_t)20, 0.5);
if (!h) { printf("FAIL RollingQuantile: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RollingQuantile", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rolling_quantile_update(h, c);
fails += cmp_row("RollingQuantile", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rolling_quantile_free(h);
return fails;
}
static int check_RollingVwap(void) {
struct RollingVwap *h = wickra_rolling_vwap_new((uintptr_t)14);
if (!h) { printf("FAIL RollingVwap: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RollingVwap", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rolling_vwap_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("RollingVwap", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rolling_vwap_free(h);
return fails;
}
static int check_RoofingFilter(void) {
struct RoofingFilter *h = wickra_roofing_filter_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL RoofingFilter: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RoofingFilter", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_roofing_filter_update(h, c);
fails += cmp_row("RoofingFilter", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_roofing_filter_free(h);
return fails;
}
static int check_Rsi(void) {
struct Rsi *h = wickra_rsi_new((uintptr_t)14);
if (!h) { printf("FAIL Rsi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Rsi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rsi_update(h, c);
fails += cmp_row("Rsi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rsi_free(h);
return fails;
}
static int check_Rsx(void) {
struct Rsx *h = wickra_rsx_new((uintptr_t)14);
if (!h) { printf("FAIL Rsx: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Rsx", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rsx_update(h, c);
fails += cmp_row("Rsx", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rsx_free(h);
return fails;
}
static int check_RunBars(void) {
struct RunBars *h = wickra_run_bars_new((uintptr_t)3);
if (!h) { printf("FAIL RunBars: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RunBars", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraRunBar bbuf[256];
uintptr_t k = wickra_run_bars_update(h, o, hi, lo, c, 1.0, 0, bbuf, 256);
for (uintptr_t b = 0; b < (uintptr_t)k; b++) {
got[gn++] = (double)bbuf[b].open;
got[gn++] = (double)bbuf[b].high;
got[gn++] = (double)bbuf[b].low;
got[gn++] = (double)bbuf[b].close;
got[gn++] = (double)bbuf[b].length;
got[gn++] = (double)bbuf[b].direction;
}
fails += cmp_row("RunBars", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_run_bars_free(h);
return fails;
}
static int check_Rvi(void) {
struct Rvi *h = wickra_rvi_new((uintptr_t)14);
if (!h) { printf("FAIL Rvi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Rvi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rvi_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Rvi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rvi_free(h);
return fails;
}
static int check_RviVolatility(void) {
struct RviVolatility *h = wickra_rvi_volatility_new((uintptr_t)14);
if (!h) { printf("FAIL RviVolatility: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_RviVolatility", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_rvi_volatility_update(h, c);
fails += cmp_row("RviVolatility", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rvi_volatility_free(h);
return fails;
}
static int check_Rwi(void) {
struct Rwi *h = wickra_rwi_new((uintptr_t)14);
if (!h) { printf("FAIL Rwi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Rwi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraRwiOutput out;
if (wickra_rwi_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.high;
got[gn++] = out.low;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("Rwi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_rwi_free(h);
return fails;
}
static int check_SampleEntropy(void) {
struct SampleEntropy *h = wickra_sample_entropy_new((uintptr_t)20, (uintptr_t)2, 0.2);
if (!h) { printf("FAIL SampleEntropy: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SampleEntropy", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_sample_entropy_update(h, c);
fails += cmp_row("SampleEntropy", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_sample_entropy_free(h);
return fails;
}
static int check_SarExt(void) {
struct SarExt *h = wickra_sar_ext_new(2.0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5);
if (!h) { printf("FAIL SarExt: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SarExt", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_sar_ext_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("SarExt", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_sar_ext_free(h);
return fails;
}
static int check_SeasonalZScore(void) {
struct SeasonalZScore *h = wickra_seasonal_z_score_new((int32_t)14);
if (!h) { printf("FAIL SeasonalZScore: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SeasonalZScore", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_seasonal_z_score_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("SeasonalZScore", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_seasonal_z_score_free(h);
return fails;
}
static int check_SeparatingLines(void) {
struct SeparatingLines *h = wickra_separating_lines_new();
if (!h) { printf("FAIL SeparatingLines: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SeparatingLines", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_separating_lines_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("SeparatingLines", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_separating_lines_free(h);
return fails;
}
static int check_SessionHighLow(void) {
struct SessionHighLow *h = wickra_session_high_low_new((int32_t)14);
if (!h) { printf("FAIL SessionHighLow: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SessionHighLow", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraSessionHighLowOutput out;
if (wickra_session_high_low_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.high;
got[gn++] = out.low;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("SessionHighLow", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_session_high_low_free(h);
return fails;
}
static int check_SessionRange(void) {
struct SessionRange *h = wickra_session_range_new((int32_t)14);
if (!h) { printf("FAIL SessionRange: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SessionRange", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraSessionRangeOutput out;
if (wickra_session_range_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.asia;
got[gn++] = out.eu;
got[gn++] = out.us;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("SessionRange", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_session_range_free(h);
return fails;
}
static int check_SessionVwap(void) {
struct SessionVwap *h = wickra_session_vwap_new((int32_t)14);
if (!h) { printf("FAIL SessionVwap: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SessionVwap", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_session_vwap_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("SessionVwap", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_session_vwap_free(h);
return fails;
}
static int check_ShannonEntropy(void) {
struct ShannonEntropy *h = wickra_shannon_entropy_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL ShannonEntropy: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ShannonEntropy", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_shannon_entropy_update(h, c);
fails += cmp_row("ShannonEntropy", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_shannon_entropy_free(h);
return fails;
}
static int check_Shark(void) {
struct Shark *h = wickra_shark_new();
if (!h) { printf("FAIL Shark: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Shark", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_shark_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Shark", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_shark_free(h);
return fails;
}
static int check_SharpeRatio(void) {
struct SharpeRatio *h = wickra_sharpe_ratio_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL SharpeRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SharpeRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_sharpe_ratio_update(h, c);
fails += cmp_row("SharpeRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_sharpe_ratio_free(h);
return fails;
}
static int check_ShootingStar(void) {
struct ShootingStar *h = wickra_shooting_star_new();
if (!h) { printf("FAIL ShootingStar: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ShootingStar", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_shooting_star_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ShootingStar", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_shooting_star_free(h);
return fails;
}
static int check_ShortLine(void) {
struct ShortLine *h = wickra_short_line_new();
if (!h) { printf("FAIL ShortLine: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ShortLine", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_short_line_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ShortLine", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_short_line_free(h);
return fails;
}
static int check_SignedVolume(void) {
struct SignedVolume *h = wickra_signed_volume_new();
if (!h) { printf("FAIL SignedVolume: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SignedVolume", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_signed_volume_update(h, c, v, c >= o, (int64_t)i);
fails += cmp_row("SignedVolume", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_signed_volume_free(h);
return fails;
}
static int check_SineWave(void) {
struct SineWave *h = wickra_sine_wave_new();
if (!h) { printf("FAIL SineWave: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SineWave", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_sine_wave_update(h, c);
fails += cmp_row("SineWave", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_sine_wave_free(h);
return fails;
}
static int check_SineWeightedMa(void) {
struct SineWeightedMa *h = wickra_sine_weighted_ma_new((uintptr_t)14);
if (!h) { printf("FAIL SineWeightedMa: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SineWeightedMa", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_sine_weighted_ma_update(h, c);
fails += cmp_row("SineWeightedMa", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_sine_weighted_ma_free(h);
return fails;
}
static int check_SinglePrints(void) {
struct SinglePrints *h = wickra_single_prints_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL SinglePrints: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SinglePrints", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_single_prints_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("SinglePrints", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_single_prints_free(h);
return fails;
}
static int check_Skewness(void) {
struct Skewness *h = wickra_skewness_new((uintptr_t)14);
if (!h) { printf("FAIL Skewness: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Skewness", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_skewness_update(h, c);
fails += cmp_row("Skewness", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_skewness_free(h);
return fails;
}
static int check_Sma(void) {
struct Sma *h = wickra_sma_new((uintptr_t)14);
if (!h) { printf("FAIL Sma: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Sma", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_sma_update(h, c);
fails += cmp_row("Sma", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_sma_free(h);
return fails;
}
static int check_Smi(void) {
struct Smi *h = wickra_smi_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14);
if (!h) { printf("FAIL Smi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Smi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_smi_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Smi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_smi_free(h);
return fails;
}
static int check_Smma(void) {
struct Smma *h = wickra_smma_new((uintptr_t)14);
if (!h) { printf("FAIL Smma: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Smma", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_smma_update(h, c);
fails += cmp_row("Smma", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_smma_free(h);
return fails;
}
static int check_SmoothedHeikinAshi(void) {
struct SmoothedHeikinAshi *h = wickra_smoothed_heikin_ashi_new((uintptr_t)14);
if (!h) { printf("FAIL SmoothedHeikinAshi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SmoothedHeikinAshi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraSmoothedHeikinAshiOutput out;
if (wickra_smoothed_heikin_ashi_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.open;
got[gn++] = out.high;
got[gn++] = out.low;
got[gn++] = out.close;
} else {
for (int z = 0; z < 4; z++) got[gn++] = NANV;
}
fails += cmp_row("SmoothedHeikinAshi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_smoothed_heikin_ashi_free(h);
return fails;
}
static int check_SortinoRatio(void) {
struct SortinoRatio *h = wickra_sortino_ratio_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL SortinoRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SortinoRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_sortino_ratio_update(h, c);
fails += cmp_row("SortinoRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_sortino_ratio_free(h);
return fails;
}
static int check_SpearmanCorrelation(void) {
struct SpearmanCorrelation *h = wickra_spearman_correlation_new((uintptr_t)14);
if (!h) { printf("FAIL SpearmanCorrelation: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SpearmanCorrelation", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_spearman_correlation_update(h, c, o);
fails += cmp_row("SpearmanCorrelation", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_spearman_correlation_free(h);
return fails;
}
static int check_SpinningTop(void) {
struct SpinningTop *h = wickra_spinning_top_new();
if (!h) { printf("FAIL SpinningTop: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SpinningTop", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_spinning_top_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("SpinningTop", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_spinning_top_free(h);
return fails;
}
static int check_SpreadAr1Coefficient(void) {
struct SpreadAr1Coefficient *h = wickra_spread_ar1_coefficient_new((uintptr_t)14);
if (!h) { printf("FAIL SpreadAr1Coefficient: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SpreadAr1Coefficient", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_spread_ar1_coefficient_update(h, c, o);
fails += cmp_row("SpreadAr1Coefficient", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_spread_ar1_coefficient_free(h);
return fails;
}
static int check_SpreadBollingerBands(void) {
struct SpreadBollingerBands *h = wickra_spread_bollinger_bands_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL SpreadBollingerBands: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SpreadBollingerBands", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraSpreadBollingerBandsOutput out;
if (wickra_spread_bollinger_bands_update(h, c, o, &out)) {
got[gn++] = out.middle;
got[gn++] = out.upper;
got[gn++] = out.lower;
got[gn++] = out.percent_b;
} else {
for (int z = 0; z < 4; z++) got[gn++] = NANV;
}
fails += cmp_row("SpreadBollingerBands", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_spread_bollinger_bands_free(h);
return fails;
}
static int check_SpreadHurst(void) {
struct SpreadHurst *h = wickra_spread_hurst_new((uintptr_t)14);
if (!h) { printf("FAIL SpreadHurst: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SpreadHurst", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_spread_hurst_update(h, c, o);
fails += cmp_row("SpreadHurst", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_spread_hurst_free(h);
return fails;
}
static int check_StalledPattern(void) {
struct StalledPattern *h = wickra_stalled_pattern_new();
if (!h) { printf("FAIL StalledPattern: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_StalledPattern", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_stalled_pattern_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("StalledPattern", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_stalled_pattern_free(h);
return fails;
}
static int check_StandardError(void) {
struct StandardError *h = wickra_standard_error_new((uintptr_t)14);
if (!h) { printf("FAIL StandardError: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_StandardError", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_standard_error_update(h, c);
fails += cmp_row("StandardError", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_standard_error_free(h);
return fails;
}
static int check_StandardErrorBands(void) {
struct StandardErrorBands *h = wickra_standard_error_bands_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL StandardErrorBands: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_StandardErrorBands", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraStandardErrorBandsOutput out;
if (wickra_standard_error_bands_update(h, c, &out)) {
got[gn++] = out.upper;
got[gn++] = out.middle;
got[gn++] = out.lower;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("StandardErrorBands", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_standard_error_bands_free(h);
return fails;
}
static int check_StarcBands(void) {
struct StarcBands *h = wickra_starc_bands_new((uintptr_t)3, (uintptr_t)7, 2.0);
if (!h) { printf("FAIL StarcBands: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_StarcBands", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraStarcBandsOutput out;
if (wickra_starc_bands_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.upper;
got[gn++] = out.middle;
got[gn++] = out.lower;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("StarcBands", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_starc_bands_free(h);
return fails;
}
static int check_Stc(void) {
struct Stc *h = wickra_stc_new((uintptr_t)10, (uintptr_t)23, (uintptr_t)10, 0.5);
if (!h) { printf("FAIL Stc: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Stc", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_stc_update(h, c);
fails += cmp_row("Stc", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_stc_free(h);
return fails;
}
static int check_StdDev(void) {
struct StdDev *h = wickra_std_dev_new((uintptr_t)14);
if (!h) { printf("FAIL StdDev: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_StdDev", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_std_dev_update(h, c);
fails += cmp_row("StdDev", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_std_dev_free(h);
return fails;
}
static int check_StepTrailingStop(void) {
struct StepTrailingStop *h = wickra_step_trailing_stop_new(2.0);
if (!h) { printf("FAIL StepTrailingStop: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_StepTrailingStop", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_step_trailing_stop_update(h, c);
fails += cmp_row("StepTrailingStop", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_step_trailing_stop_free(h);
return fails;
}
static int check_SterlingRatio(void) {
struct SterlingRatio *h = wickra_sterling_ratio_new((uintptr_t)14);
if (!h) { printf("FAIL SterlingRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SterlingRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_sterling_ratio_update(h, c);
fails += cmp_row("SterlingRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_sterling_ratio_free(h);
return fails;
}
static int check_StickSandwich(void) {
struct StickSandwich *h = wickra_stick_sandwich_new();
if (!h) { printf("FAIL StickSandwich: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_StickSandwich", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_stick_sandwich_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("StickSandwich", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_stick_sandwich_free(h);
return fails;
}
static int check_StochRsi(void) {
struct StochRsi *h = wickra_stoch_rsi_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL StochRsi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_StochRsi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_stoch_rsi_update(h, c);
fails += cmp_row("StochRsi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_stoch_rsi_free(h);
return fails;
}
static int check_Stochastic(void) {
struct Stochastic *h = wickra_stochastic_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL Stochastic: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Stochastic", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraStochasticOutput out;
if (wickra_stochastic_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.k;
got[gn++] = out.d;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("Stochastic", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_stochastic_free(h);
return fails;
}
static int check_StochasticCci(void) {
struct StochasticCci *h = wickra_stochastic_cci_new((uintptr_t)14);
if (!h) { printf("FAIL StochasticCci: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_StochasticCci", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_stochastic_cci_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("StochasticCci", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_stochastic_cci_free(h);
return fails;
}
static int check_SuperSmoother(void) {
struct SuperSmoother *h = wickra_super_smoother_new((uintptr_t)14);
if (!h) { printf("FAIL SuperSmoother: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SuperSmoother", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_super_smoother_update(h, c);
fails += cmp_row("SuperSmoother", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_super_smoother_free(h);
return fails;
}
static int check_SuperTrend(void) {
struct SuperTrend *h = wickra_super_trend_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL SuperTrend: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_SuperTrend", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraSuperTrendOutput out;
if (wickra_super_trend_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.value;
got[gn++] = out.direction;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("SuperTrend", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_super_trend_free(h);
return fails;
}
static int check_T3(void) {
struct T3 *h = wickra_t3_new((uintptr_t)5, 0.7);
if (!h) { printf("FAIL T3: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_T3", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_t3_update(h, c);
fails += cmp_row("T3", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_t3_free(h);
return fails;
}
static int check_TailRatio(void) {
struct TailRatio *h = wickra_tail_ratio_new((uintptr_t)14);
if (!h) { printf("FAIL TailRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TailRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_tail_ratio_update(h, c);
fails += cmp_row("TailRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_tail_ratio_free(h);
return fails;
}
static int check_TakerBuySellRatio(void) {
struct TakerBuySellRatio *h = wickra_taker_buy_sell_ratio_new();
if (!h) { printf("FAIL TakerBuySellRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TakerBuySellRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo;
got[gn++] = wickra_taker_buy_sell_ratio_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i);
fails += cmp_row("TakerBuySellRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_taker_buy_sell_ratio_free(h);
return fails;
}
static int check_Takuri(void) {
struct Takuri *h = wickra_takuri_new();
if (!h) { printf("FAIL Takuri: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Takuri", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_takuri_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Takuri", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_takuri_free(h);
return fails;
}
static int check_TasukiGap(void) {
struct TasukiGap *h = wickra_tasuki_gap_new();
if (!h) { printf("FAIL TasukiGap: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TasukiGap", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_tasuki_gap_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TasukiGap", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_tasuki_gap_free(h);
return fails;
}
static int check_TdCamouflage(void) {
struct TdCamouflage *h = wickra_td_camouflage_new();
if (!h) { printf("FAIL TdCamouflage: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdCamouflage", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_td_camouflage_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TdCamouflage", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_camouflage_free(h);
return fails;
}
static int check_TdClop(void) {
struct TdClop *h = wickra_td_clop_new();
if (!h) { printf("FAIL TdClop: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdClop", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_td_clop_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TdClop", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_clop_free(h);
return fails;
}
static int check_TdClopwin(void) {
struct TdClopwin *h = wickra_td_clopwin_new();
if (!h) { printf("FAIL TdClopwin: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdClopwin", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_td_clopwin_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TdClopwin", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_clopwin_free(h);
return fails;
}
static int check_TdCombo(void) {
struct TdCombo *h = wickra_td_combo_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14, (uintptr_t)28);
if (!h) { printf("FAIL TdCombo: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdCombo", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_td_combo_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TdCombo", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_combo_free(h);
return fails;
}
static int check_TdCountdown(void) {
struct TdCountdown *h = wickra_td_countdown_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14, (uintptr_t)28);
if (!h) { printf("FAIL TdCountdown: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdCountdown", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_td_countdown_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TdCountdown", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_countdown_free(h);
return fails;
}
static int check_TdDWave(void) {
struct TdDWave *h = wickra_td_d_wave_new((uintptr_t)2);
if (!h) { printf("FAIL TdDWave: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdDWave", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_td_d_wave_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TdDWave", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_d_wave_free(h);
return fails;
}
static int check_TdDeMarker(void) {
struct TdDeMarker *h = wickra_td_de_marker_new((uintptr_t)14);
if (!h) { printf("FAIL TdDeMarker: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdDeMarker", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_td_de_marker_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TdDeMarker", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_de_marker_free(h);
return fails;
}
static int check_TdDifferential(void) {
struct TdDifferential *h = wickra_td_differential_new();
if (!h) { printf("FAIL TdDifferential: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdDifferential", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_td_differential_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TdDifferential", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_differential_free(h);
return fails;
}
static int check_TdLines(void) {
struct TdLines *h = wickra_td_lines_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL TdLines: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdLines", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraTdLinesOutput out;
if (wickra_td_lines_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.resistance;
got[gn++] = out.support;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("TdLines", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_lines_free(h);
return fails;
}
static int check_TdMovingAverage(void) {
struct TdMovingAverage *h = wickra_td_moving_average_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL TdMovingAverage: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdMovingAverage", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraTdMovingAverageOutput out;
if (wickra_td_moving_average_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.st1;
got[gn++] = out.st2;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("TdMovingAverage", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_moving_average_free(h);
return fails;
}
static int check_TdOpen(void) {
struct TdOpen *h = wickra_td_open_new();
if (!h) { printf("FAIL TdOpen: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdOpen", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_td_open_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TdOpen", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_open_free(h);
return fails;
}
static int check_TdPressure(void) {
struct TdPressure *h = wickra_td_pressure_new((uintptr_t)14);
if (!h) { printf("FAIL TdPressure: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdPressure", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_td_pressure_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TdPressure", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_pressure_free(h);
return fails;
}
static int check_TdPropulsion(void) {
struct TdPropulsion *h = wickra_td_propulsion_new();
if (!h) { printf("FAIL TdPropulsion: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdPropulsion", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_td_propulsion_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TdPropulsion", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_propulsion_free(h);
return fails;
}
static int check_TdRangeProjection(void) {
struct TdRangeProjection *h = wickra_td_range_projection_new();
if (!h) { printf("FAIL TdRangeProjection: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdRangeProjection", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraTdRangeProjectionOutput out;
if (wickra_td_range_projection_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.high;
got[gn++] = out.low;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("TdRangeProjection", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_range_projection_free(h);
return fails;
}
static int check_TdRei(void) {
struct TdRei *h = wickra_td_rei_new((uintptr_t)14);
if (!h) { printf("FAIL TdRei: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdRei", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_td_rei_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TdRei", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_rei_free(h);
return fails;
}
static int check_TdRiskLevel(void) {
struct TdRiskLevel *h = wickra_td_risk_level_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL TdRiskLevel: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdRiskLevel", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraTdRiskLevelOutput out;
if (wickra_td_risk_level_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.buy_risk;
got[gn++] = out.sell_risk;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("TdRiskLevel", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_risk_level_free(h);
return fails;
}
static int check_TdSequential(void) {
struct TdSequential *h = wickra_td_sequential_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14, (uintptr_t)28);
if (!h) { printf("FAIL TdSequential: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdSequential", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraTdSequentialOutput out;
if (wickra_td_sequential_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.setup;
got[gn++] = out.countdown;
got[gn++] = out.direction;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("TdSequential", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_sequential_free(h);
return fails;
}
static int check_TdSetup(void) {
struct TdSetup *h = wickra_td_setup_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL TdSetup: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdSetup", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_td_setup_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TdSetup", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_setup_free(h);
return fails;
}
static int check_TdTrap(void) {
struct TdTrap *h = wickra_td_trap_new();
if (!h) { printf("FAIL TdTrap: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TdTrap", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_td_trap_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TdTrap", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_td_trap_free(h);
return fails;
}
static int check_Tema(void) {
struct Tema *h = wickra_tema_new((uintptr_t)14);
if (!h) { printf("FAIL Tema: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Tema", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_tema_update(h, c);
fails += cmp_row("Tema", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_tema_free(h);
return fails;
}
static int check_TermStructureBasis(void) {
struct TermStructureBasis *h = wickra_term_structure_basis_new();
if (!h) { printf("FAIL TermStructureBasis: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TermStructureBasis", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo;
got[gn++] = wickra_term_structure_basis_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i);
fails += cmp_row("TermStructureBasis", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_term_structure_basis_free(h);
return fails;
}
static int check_ThreeDrives(void) {
struct ThreeDrives *h = wickra_three_drives_new();
if (!h) { printf("FAIL ThreeDrives: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ThreeDrives", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_three_drives_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ThreeDrives", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_three_drives_free(h);
return fails;
}
static int check_ThreeInside(void) {
struct ThreeInside *h = wickra_three_inside_new();
if (!h) { printf("FAIL ThreeInside: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ThreeInside", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_three_inside_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ThreeInside", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_three_inside_free(h);
return fails;
}
static int check_ThreeLineBreak(void) {
struct ThreeLineBreak *h = wickra_three_line_break_new((uintptr_t)14);
if (!h) { printf("FAIL ThreeLineBreak: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ThreeLineBreak", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_three_line_break_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ThreeLineBreak", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_three_line_break_free(h);
return fails;
}
static int check_ThreeLineBreakBars(void) {
struct ThreeLineBreakBars *h = wickra_three_line_break_bars_new((uintptr_t)3);
if (!h) { printf("FAIL ThreeLineBreakBars: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ThreeLineBreakBars", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraLineBreakBar bbuf[256];
uintptr_t k = wickra_three_line_break_bars_update(h, c, c, c, c, 1.0, 0, bbuf, 256);
for (uintptr_t b = 0; b < (uintptr_t)k; b++) {
got[gn++] = (double)bbuf[b].open;
got[gn++] = (double)bbuf[b].close;
got[gn++] = (double)bbuf[b].direction;
}
fails += cmp_row("ThreeLineBreakBars", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_three_line_break_bars_free(h);
return fails;
}
static int check_ThreeLineStrike(void) {
struct ThreeLineStrike *h = wickra_three_line_strike_new();
if (!h) { printf("FAIL ThreeLineStrike: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ThreeLineStrike", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_three_line_strike_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ThreeLineStrike", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_three_line_strike_free(h);
return fails;
}
static int check_ThreeOutside(void) {
struct ThreeOutside *h = wickra_three_outside_new();
if (!h) { printf("FAIL ThreeOutside: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ThreeOutside", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_three_outside_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ThreeOutside", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_three_outside_free(h);
return fails;
}
static int check_ThreeSoldiersOrCrows(void) {
struct ThreeSoldiersOrCrows *h = wickra_three_soldiers_or_crows_new();
if (!h) { printf("FAIL ThreeSoldiersOrCrows: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ThreeSoldiersOrCrows", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_three_soldiers_or_crows_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ThreeSoldiersOrCrows", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_three_soldiers_or_crows_free(h);
return fails;
}
static int check_ThreeStarsInSouth(void) {
struct ThreeStarsInSouth *h = wickra_three_stars_in_south_new();
if (!h) { printf("FAIL ThreeStarsInSouth: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ThreeStarsInSouth", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_three_stars_in_south_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("ThreeStarsInSouth", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_three_stars_in_south_free(h);
return fails;
}
static int check_Thrusting(void) {
struct Thrusting *h = wickra_thrusting_new();
if (!h) { printf("FAIL Thrusting: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Thrusting", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_thrusting_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Thrusting", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_thrusting_free(h);
return fails;
}
static int check_TickBars(void) {
struct TickBars *h = wickra_tick_bars_new((uintptr_t)2);
if (!h) { printf("FAIL TickBars: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TickBars", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraTickBar bbuf[256];
uintptr_t k = wickra_tick_bars_update(h, o, hi, lo, c, v, 0, bbuf, 256);
for (uintptr_t b = 0; b < (uintptr_t)k; b++) {
got[gn++] = (double)bbuf[b].open;
got[gn++] = (double)bbuf[b].high;
got[gn++] = (double)bbuf[b].low;
got[gn++] = (double)bbuf[b].close;
got[gn++] = (double)bbuf[b].volume;
}
fails += cmp_row("TickBars", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_tick_bars_free(h);
return fails;
}
static int check_TickIndex(void) {
struct TickIndex *h = wickra_tick_index_new();
if (!h) { printf("FAIL TickIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TickIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5];
for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); }
got[gn++] = wickra_tick_index_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i);
fails += cmp_row("TickIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_tick_index_free(h);
return fails;
}
static int check_Tii(void) {
struct Tii *h = wickra_tii_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL Tii: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Tii", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_tii_update(h, c);
fails += cmp_row("Tii", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_tii_free(h);
return fails;
}
static int check_TimeBasedStop(void) {
struct TimeBasedStop *h = wickra_time_based_stop_new((uintptr_t)14);
if (!h) { printf("FAIL TimeBasedStop: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TimeBasedStop", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_time_based_stop_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TimeBasedStop", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_time_based_stop_free(h);
return fails;
}
static int check_TimeOfDayReturnProfile(void) {
struct TimeOfDayReturnProfile *h = wickra_time_of_day_return_profile_new((uintptr_t)24, (int32_t)0);
if (!h) { printf("FAIL TimeOfDayReturnProfile: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TimeOfDayReturnProfile", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double vbuf[256];
intptr_t k = wickra_time_of_day_return_profile_update(h, o, hi, lo, c, v, (int64_t)i, vbuf, 256);
if (k < 0) { for (int z = 0; z < 24; z++) got[gn++] = NANV; }
else { for (int z = 0; z < 24; z++) got[gn++] = vbuf[z]; }
fails += cmp_row("TimeOfDayReturnProfile", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_time_of_day_return_profile_free(h);
return fails;
}
static int check_TowerTopBottom(void) {
struct TowerTopBottom *h = wickra_tower_top_bottom_new();
if (!h) { printf("FAIL TowerTopBottom: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TowerTopBottom", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_tower_top_bottom_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TowerTopBottom", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_tower_top_bottom_free(h);
return fails;
}
static int check_TpoProfile(void) {
struct TpoProfile *h = wickra_tpo_profile_new((uintptr_t)30, (uintptr_t)50);
if (!h) { printf("FAIL TpoProfile: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TpoProfile", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double vbuf[256];
struct WickraTpoProfileOutputScalars sc;
intptr_t k = wickra_tpo_profile_update(h, o, hi, lo, c, v, (int64_t)i, &sc, vbuf, 256);
if (k < 0) { for (int z = 0; z < 52; z++) got[gn++] = NANV; }
else { got[gn++] = sc.price_low; got[gn++] = sc.price_high;
for (int z = 0; z < 50; z++) got[gn++] = vbuf[z]; }
fails += cmp_row("TpoProfile", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_tpo_profile_free(h);
return fails;
}
static int check_TradeImbalance(void) {
struct TradeImbalance *h = wickra_trade_imbalance_new((uintptr_t)20);
if (!h) { printf("FAIL TradeImbalance: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TradeImbalance", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_trade_imbalance_update(h, c, v, c >= o, (int64_t)i);
fails += cmp_row("TradeImbalance", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_trade_imbalance_free(h);
return fails;
}
static int check_TradeSignAutocorrelation(void) {
struct TradeSignAutocorrelation *h = wickra_trade_sign_autocorrelation_new((uintptr_t)20);
if (!h) { printf("FAIL TradeSignAutocorrelation: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TradeSignAutocorrelation", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_trade_sign_autocorrelation_update(h, c, v, c >= o, (int64_t)i);
fails += cmp_row("TradeSignAutocorrelation", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_trade_sign_autocorrelation_free(h);
return fails;
}
static int check_TradeVolumeIndex(void) {
struct TradeVolumeIndex *h = wickra_trade_volume_index_new(2.0);
if (!h) { printf("FAIL TradeVolumeIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TradeVolumeIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_trade_volume_index_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TradeVolumeIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_trade_volume_index_free(h);
return fails;
}
static int check_TrendLabel(void) {
struct TrendLabel *h = wickra_trend_label_new((uintptr_t)14);
if (!h) { printf("FAIL TrendLabel: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TrendLabel", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_trend_label_update(h, c);
fails += cmp_row("TrendLabel", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_trend_label_free(h);
return fails;
}
static int check_TrendStrengthIndex(void) {
struct TrendStrengthIndex *h = wickra_trend_strength_index_new((uintptr_t)14);
if (!h) { printf("FAIL TrendStrengthIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TrendStrengthIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_trend_strength_index_update(h, c);
fails += cmp_row("TrendStrengthIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_trend_strength_index_free(h);
return fails;
}
static int check_Trendflex(void) {
struct Trendflex *h = wickra_trendflex_new((uintptr_t)14);
if (!h) { printf("FAIL Trendflex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Trendflex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_trendflex_update(h, c);
fails += cmp_row("Trendflex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_trendflex_free(h);
return fails;
}
static int check_TreynorRatio(void) {
struct TreynorRatio *h = wickra_treynor_ratio_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL TreynorRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TreynorRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_treynor_ratio_update(h, c, o);
fails += cmp_row("TreynorRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_treynor_ratio_free(h);
return fails;
}
static int check_Triangle(void) {
struct Triangle *h = wickra_triangle_new();
if (!h) { printf("FAIL Triangle: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Triangle", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_triangle_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Triangle", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_triangle_free(h);
return fails;
}
static int check_Trima(void) {
struct Trima *h = wickra_trima_new((uintptr_t)14);
if (!h) { printf("FAIL Trima: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Trima", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_trima_update(h, c);
fails += cmp_row("Trima", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_trima_free(h);
return fails;
}
static int check_Trin(void) {
struct Trin *h = wickra_trin_new();
if (!h) { printf("FAIL Trin: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Trin", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5];
for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); }
got[gn++] = wickra_trin_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i);
fails += cmp_row("Trin", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_trin_free(h);
return fails;
}
static int check_TripleTopBottom(void) {
struct TripleTopBottom *h = wickra_triple_top_bottom_new();
if (!h) { printf("FAIL TripleTopBottom: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TripleTopBottom", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_triple_top_bottom_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TripleTopBottom", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_triple_top_bottom_free(h);
return fails;
}
static int check_Tristar(void) {
struct Tristar *h = wickra_tristar_new();
if (!h) { printf("FAIL Tristar: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Tristar", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_tristar_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Tristar", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_tristar_free(h);
return fails;
}
static int check_Trix(void) {
struct Trix *h = wickra_trix_new((uintptr_t)14);
if (!h) { printf("FAIL Trix: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Trix", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_trix_update(h, c);
fails += cmp_row("Trix", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_trix_free(h);
return fails;
}
static int check_TrueRange(void) {
struct TrueRange *h = wickra_true_range_new();
if (!h) { printf("FAIL TrueRange: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TrueRange", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_true_range_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TrueRange", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_true_range_free(h);
return fails;
}
static int check_Tsf(void) {
struct Tsf *h = wickra_tsf_new((uintptr_t)14);
if (!h) { printf("FAIL Tsf: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Tsf", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_tsf_update(h, c);
fails += cmp_row("Tsf", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_tsf_free(h);
return fails;
}
static int check_TsfOscillator(void) {
struct TsfOscillator *h = wickra_tsf_oscillator_new((uintptr_t)14);
if (!h) { printf("FAIL TsfOscillator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TsfOscillator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_tsf_oscillator_update(h, c);
fails += cmp_row("TsfOscillator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_tsf_oscillator_free(h);
return fails;
}
static int check_Tsi(void) {
struct Tsi *h = wickra_tsi_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL Tsi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Tsi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_tsi_update(h, c);
fails += cmp_row("Tsi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_tsi_free(h);
return fails;
}
static int check_Tsv(void) {
struct Tsv *h = wickra_tsv_new((uintptr_t)14);
if (!h) { printf("FAIL Tsv: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Tsv", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_tsv_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Tsv", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_tsv_free(h);
return fails;
}
static int check_TtmSqueeze(void) {
struct TtmSqueeze *h = wickra_ttm_squeeze_new((uintptr_t)14, 2.0, 0.5);
if (!h) { printf("FAIL TtmSqueeze: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TtmSqueeze", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraTtmSqueezeOutput out;
if (wickra_ttm_squeeze_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.squeeze;
got[gn++] = out.momentum;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("TtmSqueeze", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ttm_squeeze_free(h);
return fails;
}
static int check_TtmTrend(void) {
struct TtmTrend *h = wickra_ttm_trend_new((uintptr_t)14);
if (!h) { printf("FAIL TtmTrend: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TtmTrend", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_ttm_trend_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TtmTrend", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ttm_trend_free(h);
return fails;
}
static int check_TurnOfMonth(void) {
struct TurnOfMonth *h = wickra_turn_of_month_new(3.0, 3.0, (int32_t)0);
if (!h) { printf("FAIL TurnOfMonth: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TurnOfMonth", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_turn_of_month_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TurnOfMonth", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_turn_of_month_free(h);
return fails;
}
static int check_Tweezer(void) {
struct Tweezer *h = wickra_tweezer_new();
if (!h) { printf("FAIL Tweezer: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Tweezer", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_tweezer_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Tweezer", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_tweezer_free(h);
return fails;
}
static int check_TwiggsMoneyFlow(void) {
struct TwiggsMoneyFlow *h = wickra_twiggs_money_flow_new((uintptr_t)14);
if (!h) { printf("FAIL TwiggsMoneyFlow: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TwiggsMoneyFlow", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_twiggs_money_flow_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TwiggsMoneyFlow", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_twiggs_money_flow_free(h);
return fails;
}
static int check_TwoCrows(void) {
struct TwoCrows *h = wickra_two_crows_new();
if (!h) { printf("FAIL TwoCrows: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TwoCrows", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_two_crows_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TwoCrows", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_two_crows_free(h);
return fails;
}
static int check_TypicalPrice(void) {
struct TypicalPrice *h = wickra_typical_price_new();
if (!h) { printf("FAIL TypicalPrice: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_TypicalPrice", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_typical_price_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("TypicalPrice", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_typical_price_free(h);
return fails;
}
static int check_UlcerIndex(void) {
struct UlcerIndex *h = wickra_ulcer_index_new((uintptr_t)14);
if (!h) { printf("FAIL UlcerIndex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_UlcerIndex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_ulcer_index_update(h, c);
fails += cmp_row("UlcerIndex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ulcer_index_free(h);
return fails;
}
static int check_UltimateOscillator(void) {
struct UltimateOscillator *h = wickra_ultimate_oscillator_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14);
if (!h) { printf("FAIL UltimateOscillator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_UltimateOscillator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_ultimate_oscillator_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("UltimateOscillator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_ultimate_oscillator_free(h);
return fails;
}
static int check_UniqueThreeRiver(void) {
struct UniqueThreeRiver *h = wickra_unique_three_river_new();
if (!h) { printf("FAIL UniqueThreeRiver: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_UniqueThreeRiver", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_unique_three_river_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("UniqueThreeRiver", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_unique_three_river_free(h);
return fails;
}
static int check_UniversalOscillator(void) {
struct UniversalOscillator *h = wickra_universal_oscillator_new((uintptr_t)14);
if (!h) { printf("FAIL UniversalOscillator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_UniversalOscillator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_universal_oscillator_update(h, c);
fails += cmp_row("UniversalOscillator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_universal_oscillator_free(h);
return fails;
}
static int check_UpDownVolumeRatio(void) {
struct UpDownVolumeRatio *h = wickra_up_down_volume_ratio_new();
if (!h) { printf("FAIL UpDownVolumeRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_UpDownVolumeRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5];
for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); }
got[gn++] = wickra_up_down_volume_ratio_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i);
fails += cmp_row("UpDownVolumeRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_up_down_volume_ratio_free(h);
return fails;
}
static int check_UpsideGapThreeMethods(void) {
struct UpsideGapThreeMethods *h = wickra_upside_gap_three_methods_new();
if (!h) { printf("FAIL UpsideGapThreeMethods: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_UpsideGapThreeMethods", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_upside_gap_three_methods_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("UpsideGapThreeMethods", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_upside_gap_three_methods_free(h);
return fails;
}
static int check_UpsideGapTwoCrows(void) {
struct UpsideGapTwoCrows *h = wickra_upside_gap_two_crows_new();
if (!h) { printf("FAIL UpsideGapTwoCrows: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_UpsideGapTwoCrows", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_upside_gap_two_crows_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("UpsideGapTwoCrows", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_upside_gap_two_crows_free(h);
return fails;
}
static int check_UpsidePotentialRatio(void) {
struct UpsidePotentialRatio *h = wickra_upside_potential_ratio_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL UpsidePotentialRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_UpsidePotentialRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_upside_potential_ratio_update(h, c);
fails += cmp_row("UpsidePotentialRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_upside_potential_ratio_free(h);
return fails;
}
static int check_ValueArea(void) {
struct ValueArea *h = wickra_value_area_new((uintptr_t)20, (uintptr_t)50, 0.7);
if (!h) { printf("FAIL ValueArea: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ValueArea", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraValueAreaOutput out;
if (wickra_value_area_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.poc;
got[gn++] = out.vah;
got[gn++] = out.val;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("ValueArea", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_value_area_free(h);
return fails;
}
static int check_ValueAtRisk(void) {
struct ValueAtRisk *h = wickra_value_at_risk_new((uintptr_t)20, 0.95);
if (!h) { printf("FAIL ValueAtRisk: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ValueAtRisk", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_value_at_risk_update(h, c);
fails += cmp_row("ValueAtRisk", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_value_at_risk_free(h);
return fails;
}
static int check_Variance(void) {
struct Variance *h = wickra_variance_new((uintptr_t)14);
if (!h) { printf("FAIL Variance: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Variance", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_variance_update(h, c);
fails += cmp_row("Variance", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_variance_free(h);
return fails;
}
static int check_VarianceRatio(void) {
struct VarianceRatio *h = wickra_variance_ratio_new((uintptr_t)60, (uintptr_t)2);
if (!h) { printf("FAIL VarianceRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_VarianceRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_variance_ratio_update(h, c, o);
fails += cmp_row("VarianceRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_variance_ratio_free(h);
return fails;
}
static int check_VerticalHorizontalFilter(void) {
struct VerticalHorizontalFilter *h = wickra_vertical_horizontal_filter_new((uintptr_t)14);
if (!h) { printf("FAIL VerticalHorizontalFilter: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_VerticalHorizontalFilter", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_vertical_horizontal_filter_update(h, c);
fails += cmp_row("VerticalHorizontalFilter", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_vertical_horizontal_filter_free(h);
return fails;
}
static int check_Vidya(void) {
struct Vidya *h = wickra_vidya_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL Vidya: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Vidya", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_vidya_update(h, c);
fails += cmp_row("Vidya", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_vidya_free(h);
return fails;
}
static int check_VolatilityCone(void) {
struct VolatilityCone *h = wickra_volatility_cone_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL VolatilityCone: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_VolatilityCone", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraVolatilityConeOutput out;
if (wickra_volatility_cone_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.current;
got[gn++] = out.min;
got[gn++] = out.median;
got[gn++] = out.max;
got[gn++] = out.percentile;
} else {
for (int z = 0; z < 5; z++) got[gn++] = NANV;
}
fails += cmp_row("VolatilityCone", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_volatility_cone_free(h);
return fails;
}
static int check_VolatilityOfVolatility(void) {
struct VolatilityOfVolatility *h = wickra_volatility_of_volatility_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL VolatilityOfVolatility: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_VolatilityOfVolatility", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_volatility_of_volatility_update(h, c);
fails += cmp_row("VolatilityOfVolatility", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_volatility_of_volatility_free(h);
return fails;
}
static int check_VolatilityRatio(void) {
struct VolatilityRatio *h = wickra_volatility_ratio_new((uintptr_t)14);
if (!h) { printf("FAIL VolatilityRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_VolatilityRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_volatility_ratio_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("VolatilityRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_volatility_ratio_free(h);
return fails;
}
static int check_VoltyStop(void) {
struct VoltyStop *h = wickra_volty_stop_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL VoltyStop: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_VoltyStop", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_volty_stop_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("VoltyStop", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_volty_stop_free(h);
return fails;
}
static int check_VolumeBars(void) {
struct VolumeBars *h = wickra_volume_bars_new(500.0);
if (!h) { printf("FAIL VolumeBars: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_VolumeBars", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraVolumeBar bbuf[256];
uintptr_t k = wickra_volume_bars_update(h, o, hi, lo, c, v, 0, bbuf, 256);
for (uintptr_t b = 0; b < (uintptr_t)k; b++) {
got[gn++] = (double)bbuf[b].open;
got[gn++] = (double)bbuf[b].high;
got[gn++] = (double)bbuf[b].low;
got[gn++] = (double)bbuf[b].close;
got[gn++] = (double)bbuf[b].volume;
}
fails += cmp_row("VolumeBars", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_volume_bars_free(h);
return fails;
}
static int check_VolumeByTimeProfile(void) {
struct VolumeByTimeProfile *h = wickra_volume_by_time_profile_new((uintptr_t)24, (int32_t)0);
if (!h) { printf("FAIL VolumeByTimeProfile: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_VolumeByTimeProfile", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double vbuf[256];
intptr_t k = wickra_volume_by_time_profile_update(h, o, hi, lo, c, v, (int64_t)i, vbuf, 256);
if (k < 0) { for (int z = 0; z < 24; z++) got[gn++] = NANV; }
else { for (int z = 0; z < 24; z++) got[gn++] = vbuf[z]; }
fails += cmp_row("VolumeByTimeProfile", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_volume_by_time_profile_free(h);
return fails;
}
static int check_VolumeOscillator(void) {
struct VolumeOscillator *h = wickra_volume_oscillator_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL VolumeOscillator: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_VolumeOscillator", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_volume_oscillator_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("VolumeOscillator", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_volume_oscillator_free(h);
return fails;
}
static int check_VolumePriceTrend(void) {
struct VolumePriceTrend *h = wickra_volume_price_trend_new();
if (!h) { printf("FAIL VolumePriceTrend: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_VolumePriceTrend", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_volume_price_trend_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("VolumePriceTrend", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_volume_price_trend_free(h);
return fails;
}
static int check_VolumeProfile(void) {
struct VolumeProfile *h = wickra_volume_profile_new((uintptr_t)20, (uintptr_t)50);
if (!h) { printf("FAIL VolumeProfile: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_VolumeProfile", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
double vbuf[256];
struct WickraVolumeProfileOutputScalars sc;
intptr_t k = wickra_volume_profile_update(h, o, hi, lo, c, v, (int64_t)i, &sc, vbuf, 256);
if (k < 0) { for (int z = 0; z < 52; z++) got[gn++] = NANV; }
else { got[gn++] = sc.price_low; got[gn++] = sc.price_high;
for (int z = 0; z < 50; z++) got[gn++] = vbuf[z]; }
fails += cmp_row("VolumeProfile", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_volume_profile_free(h);
return fails;
}
static int check_VolumeRsi(void) {
struct VolumeRsi *h = wickra_volume_rsi_new((uintptr_t)14);
if (!h) { printf("FAIL VolumeRsi: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_VolumeRsi", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_volume_rsi_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("VolumeRsi", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_volume_rsi_free(h);
return fails;
}
static int check_VolumeWeightedMacd(void) {
struct VolumeWeightedMacd *h = wickra_volume_weighted_macd_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14);
if (!h) { printf("FAIL VolumeWeightedMacd: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_VolumeWeightedMacd", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraVolumeWeightedMacdOutput out;
if (wickra_volume_weighted_macd_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.macd;
got[gn++] = out.signal;
got[gn++] = out.histogram;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("VolumeWeightedMacd", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_volume_weighted_macd_free(h);
return fails;
}
static int check_VolumeWeightedSr(void) {
struct VolumeWeightedSr *h = wickra_volume_weighted_sr_new((uintptr_t)14);
if (!h) { printf("FAIL VolumeWeightedSr: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_VolumeWeightedSr", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraVolumeWeightedSrOutput out;
if (wickra_volume_weighted_sr_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.support;
got[gn++] = out.resistance;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("VolumeWeightedSr", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_volume_weighted_sr_free(h);
return fails;
}
static int check_Vortex(void) {
struct Vortex *h = wickra_vortex_new((uintptr_t)14);
if (!h) { printf("FAIL Vortex: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Vortex", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraVortexOutput out;
if (wickra_vortex_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.plus;
got[gn++] = out.minus;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("Vortex", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_vortex_free(h);
return fails;
}
static int check_Vpin(void) {
struct Vpin *h = wickra_vpin_new(5000.0, (uintptr_t)10);
if (!h) { printf("FAIL Vpin: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Vpin", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_vpin_update(h, c, v, c >= o, (int64_t)i);
fails += cmp_row("Vpin", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_vpin_free(h);
return fails;
}
static int check_Vwap(void) {
struct Vwap *h = wickra_vwap_new();
if (!h) { printf("FAIL Vwap: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Vwap", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_vwap_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Vwap", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_vwap_free(h);
return fails;
}
static int check_VwapStdDevBands(void) {
struct VwapStdDevBands *h = wickra_vwap_std_dev_bands_new(2.0);
if (!h) { printf("FAIL VwapStdDevBands: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_VwapStdDevBands", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraVwapStdDevBandsOutput out;
if (wickra_vwap_std_dev_bands_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.upper;
got[gn++] = out.middle;
got[gn++] = out.lower;
got[gn++] = out.stddev;
} else {
for (int z = 0; z < 4; z++) got[gn++] = NANV;
}
fails += cmp_row("VwapStdDevBands", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_vwap_std_dev_bands_free(h);
return fails;
}
static int check_Vwma(void) {
struct Vwma *h = wickra_vwma_new((uintptr_t)14);
if (!h) { printf("FAIL Vwma: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Vwma", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_vwma_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Vwma", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_vwma_free(h);
return fails;
}
static int check_Vzo(void) {
struct Vzo *h = wickra_vzo_new((uintptr_t)14);
if (!h) { printf("FAIL Vzo: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Vzo", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_vzo_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Vzo", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_vzo_free(h);
return fails;
}
static int check_Wad(void) {
struct Wad *h = wickra_wad_new();
if (!h) { printf("FAIL Wad: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Wad", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_wad_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Wad", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_wad_free(h);
return fails;
}
static int check_WavePm(void) {
struct WavePm *h = wickra_wave_pm_new((uintptr_t)3, (uintptr_t)7);
if (!h) { printf("FAIL WavePm: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_WavePm", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_wave_pm_update(h, c);
fails += cmp_row("WavePm", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_wave_pm_free(h);
return fails;
}
static int check_WaveTrend(void) {
struct WaveTrend *h = wickra_wave_trend_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14);
if (!h) { printf("FAIL WaveTrend: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_WaveTrend", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraWaveTrendOutput out;
if (wickra_wave_trend_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.wt1;
got[gn++] = out.wt2;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("WaveTrend", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_wave_trend_free(h);
return fails;
}
static int check_Wedge(void) {
struct Wedge *h = wickra_wedge_new();
if (!h) { printf("FAIL Wedge: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Wedge", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_wedge_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("Wedge", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_wedge_free(h);
return fails;
}
static int check_WeightedClose(void) {
struct WeightedClose *h = wickra_weighted_close_new();
if (!h) { printf("FAIL WeightedClose: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_WeightedClose", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_weighted_close_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("WeightedClose", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_weighted_close_free(h);
return fails;
}
static int check_WickRatio(void) {
struct WickRatio *h = wickra_wick_ratio_new();
if (!h) { printf("FAIL WickRatio: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_WickRatio", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_wick_ratio_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("WickRatio", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_wick_ratio_free(h);
return fails;
}
static int check_WilliamsFractals(void) {
struct WilliamsFractals *h = wickra_williams_fractals_new();
if (!h) { printf("FAIL WilliamsFractals: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_WilliamsFractals", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraWilliamsFractalsOutput out;
if (wickra_williams_fractals_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.up;
got[gn++] = out.down;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("WilliamsFractals", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_williams_fractals_free(h);
return fails;
}
static int check_WilliamsR(void) {
struct WilliamsR *h = wickra_williams_r_new((uintptr_t)14);
if (!h) { printf("FAIL WilliamsR: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_WilliamsR", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_williams_r_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("WilliamsR", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_williams_r_free(h);
return fails;
}
static int check_WinRate(void) {
struct WinRate *h = wickra_win_rate_new((uintptr_t)14);
if (!h) { printf("FAIL WinRate: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_WinRate", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_win_rate_update(h, c);
fails += cmp_row("WinRate", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_win_rate_free(h);
return fails;
}
static int check_Wma(void) {
struct Wma *h = wickra_wma_new((uintptr_t)14);
if (!h) { printf("FAIL Wma: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Wma", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_wma_update(h, c);
fails += cmp_row("Wma", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_wma_free(h);
return fails;
}
static int check_WoodiePivots(void) {
struct WoodiePivots *h = wickra_woodie_pivots_new();
if (!h) { printf("FAIL WoodiePivots: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_WoodiePivots", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraWoodiePivotsOutput out;
if (wickra_woodie_pivots_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.pp;
got[gn++] = out.r1;
got[gn++] = out.r2;
got[gn++] = out.s1;
got[gn++] = out.s2;
} else {
for (int z = 0; z < 5; z++) got[gn++] = NANV;
}
fails += cmp_row("WoodiePivots", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_woodie_pivots_free(h);
return fails;
}
static int check_YangZhangVolatility(void) {
struct YangZhangVolatility *h = wickra_yang_zhang_volatility_new((uintptr_t)20, (uintptr_t)252);
if (!h) { printf("FAIL YangZhangVolatility: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_YangZhangVolatility", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_yang_zhang_volatility_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("YangZhangVolatility", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_yang_zhang_volatility_free(h);
return fails;
}
static int check_YoyoExit(void) {
struct YoyoExit *h = wickra_yoyo_exit_new((uintptr_t)14, 2.0);
if (!h) { printf("FAIL YoyoExit: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_YoyoExit", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_yoyo_exit_update(h, o, hi, lo, c, v, (int64_t)i);
fails += cmp_row("YoyoExit", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_yoyo_exit_free(h);
return fails;
}
static int check_ZScore(void) {
struct ZScore *h = wickra_z_score_new((uintptr_t)14);
if (!h) { printf("FAIL ZScore: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ZScore", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_z_score_update(h, c);
fails += cmp_row("ZScore", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_z_score_free(h);
return fails;
}
static int check_ZeroLagMacd(void) {
struct ZeroLagMacd *h = wickra_zero_lag_macd_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14);
if (!h) { printf("FAIL ZeroLagMacd: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ZeroLagMacd", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraZeroLagMacdOutput out;
if (wickra_zero_lag_macd_update(h, c, &out)) {
got[gn++] = out.macd;
got[gn++] = out.signal;
got[gn++] = out.histogram;
} else {
for (int z = 0; z < 3; z++) got[gn++] = NANV;
}
fails += cmp_row("ZeroLagMacd", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_zero_lag_macd_free(h);
return fails;
}
static int check_ZigZag(void) {
struct ZigZag *h = wickra_zig_zag_new(0.02);
if (!h) { printf("FAIL ZigZag: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_ZigZag", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
struct WickraZigZagOutput out;
if (wickra_zig_zag_update(h, o, hi, lo, c, v, (int64_t)i, &out)) {
got[gn++] = out.swing;
got[gn++] = out.direction;
} else {
for (int z = 0; z < 2; z++) got[gn++] = NANV;
}
fails += cmp_row("ZigZag", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_zig_zag_free(h);
return fails;
}
static int check_Zlema(void) {
struct Zlema *h = wickra_zlema_new((uintptr_t)14);
if (!h) { printf("FAIL Zlema: new returned NULL\n"); return 1; }
double **exp; int rows = read_fixture("g_Zlema", &exp);
int fails = 0;
for (int i = 0; i < N_INPUT; i++) {
double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4];
(void)o; (void)hi; (void)lo; (void)c; (void)v;
double got[128]; int gn = 0;
got[gn++] = wickra_zlema_update(h, c);
fails += cmp_row("Zlema", i, exp[i], EXPLEN[i], got, gn);
}
free_fixture(exp, rows);
wickra_zlema_free(h);
return fails;
}
int main(int argc, char **argv) {
GDIR = (argc > 1) ? argv[1] : "testdata/golden";
load_input();
int total = 0, failed = 0;
total++; if (check_AbandonedBaby()) failed++;
total++; if (check_Abcd()) failed++;
total++; if (check_AbsoluteBreadthIndex()) failed++;
total++; if (check_AccelerationBands()) failed++;
total++; if (check_AcceleratorOscillator()) failed++;
total++; if (check_AdOscillator()) failed++;
total++; if (check_AdVolumeLine()) failed++;
total++; if (check_AdaptiveCci()) failed++;
total++; if (check_AdaptiveCycle()) failed++;
total++; if (check_AdaptiveLaguerreFilter()) failed++;
total++; if (check_AdaptiveRsi()) failed++;
total++; if (check_Adl()) failed++;
total++; if (check_AdvanceBlock()) failed++;
total++; if (check_AdvanceDecline()) failed++;
total++; if (check_AdvanceDeclineRatio()) failed++;
total++; if (check_Adx()) failed++;
total++; if (check_Adxr()) failed++;
total++; if (check_Alligator()) failed++;
total++; if (check_Alma()) failed++;
total++; if (check_Alpha()) failed++;
total++; if (check_AmihudIlliquidity()) failed++;
total++; if (check_AnchoredRsi()) failed++;
total++; if (check_AnchoredVwap()) failed++;
total++; if (check_AndrewsPitchfork()) failed++;
total++; if (check_Apo()) failed++;
total++; if (check_Aroon()) failed++;
total++; if (check_AroonOscillator()) failed++;
total++; if (check_Atr()) failed++;
total++; if (check_AtrBands()) failed++;
total++; if (check_AtrRatchet()) failed++;
total++; if (check_AtrTrailingStop()) failed++;
total++; if (check_AutoFib()) failed++;
total++; if (check_Autocorrelation()) failed++;
total++; if (check_AutocorrelationPeriodogram()) failed++;
total++; if (check_AverageDailyRange()) failed++;
total++; if (check_AverageDrawdown()) failed++;
total++; if (check_AvgPrice()) failed++;
total++; if (check_AwesomeOscillator()) failed++;
total++; if (check_AwesomeOscillatorHistogram()) failed++;
total++; if (check_BalanceOfPower()) failed++;
total++; if (check_BandpassFilter()) failed++;
total++; if (check_Bat()) failed++;
total++; if (check_BeltHold()) failed++;
total++; if (check_Beta()) failed++;
total++; if (check_BetaNeutralSpread()) failed++;
total++; if (check_BetterVolume()) failed++;
total++; if (check_BipowerVariation()) failed++;
total++; if (check_BodySizePct()) failed++;
total++; if (check_BollingerBands()) failed++;
total++; if (check_BollingerBandwidth()) failed++;
total++; if (check_BomarBands()) failed++;
total++; if (check_BreadthThrust()) failed++;
total++; if (check_Breakaway()) failed++;
total++; if (check_BullishPercentIndex()) failed++;
total++; if (check_BurkeRatio()) failed++;
total++; if (check_Butterfly()) failed++;
total++; if (check_CalendarSpread()) failed++;
total++; if (check_CalmarRatio()) failed++;
total++; if (check_Camarilla()) failed++;
total++; if (check_CandleVolume()) failed++;
total++; if (check_Cci()) failed++;
total++; if (check_CenterOfGravity()) failed++;
total++; if (check_CentralPivotRange()) failed++;
total++; if (check_Cfo()) failed++;
total++; if (check_ChaikinMoneyFlow()) failed++;
total++; if (check_ChaikinOscillator()) failed++;
total++; if (check_ChaikinVolatility()) failed++;
total++; if (check_ChandeKrollStop()) failed++;
total++; if (check_ChandelierExit()) failed++;
total++; if (check_ChoppinessIndex()) failed++;
total++; if (check_ClassicPivots()) failed++;
total++; if (check_CloseVsOpen()) failed++;
total++; if (check_ClosingMarubozu()) failed++;
total++; if (check_Cmo()) failed++;
total++; if (check_CoefficientOfVariation()) failed++;
total++; if (check_Cointegration()) failed++;
total++; if (check_CommonSenseRatio()) failed++;
total++; if (check_CompositeProfile()) failed++;
total++; if (check_ConcealingBabySwallow()) failed++;
total++; if (check_ConditionalValueAtRisk()) failed++;
total++; if (check_ConnorsRsi()) failed++;
total++; if (check_Coppock()) failed++;
total++; if (check_CorrelationTrendIndicator()) failed++;
total++; if (check_Counterattack()) failed++;
total++; if (check_Crab()) failed++;
total++; if (check_CumulativeVolumeDelta()) failed++;
total++; if (check_CumulativeVolumeIndex()) failed++;
total++; if (check_CupAndHandle()) failed++;
total++; if (check_CyberneticCycle()) failed++;
total++; if (check_Cypher()) failed++;
total++; if (check_DayOfWeekProfile()) failed++;
total++; if (check_Decycler()) failed++;
total++; if (check_DecyclerOscillator()) failed++;
total++; if (check_Dema()) failed++;
total++; if (check_DemandIndex()) failed++;
total++; if (check_DemarkPivots()) failed++;
total++; if (check_DepthSlope()) failed++;
total++; if (check_DerivativeOscillator()) failed++;
total++; if (check_DetrendedStdDev()) failed++;
total++; if (check_DisparityIndex()) failed++;
total++; if (check_DistanceSsd()) failed++;
total++; if (check_Doji()) failed++;
total++; if (check_DojiStar()) failed++;
total++; if (check_DollarBars()) failed++;
total++; if (check_Donchian()) failed++;
total++; if (check_DonchianStop()) failed++;
total++; if (check_DoubleBollinger()) failed++;
total++; if (check_DoubleTopBottom()) failed++;
total++; if (check_DownsideGapThreeMethods()) failed++;
total++; if (check_Dpo()) failed++;
total++; if (check_DragonflyDoji()) failed++;
total++; if (check_DrawdownDuration()) failed++;
total++; if (check_DumplingTop()) failed++;
total++; if (check_Dx()) failed++;
total++; if (check_DynamicMomentumIndex()) failed++;
total++; if (check_EaseOfMovement()) failed++;
total++; if (check_EffectiveSpread()) failed++;
total++; if (check_EhlersStochastic()) failed++;
total++; if (check_Ehma()) failed++;
total++; if (check_ElderImpulse()) failed++;
total++; if (check_ElderRay()) failed++;
total++; if (check_ElderSafeZone()) failed++;
total++; if (check_Ema()) failed++;
total++; if (check_EmpiricalModeDecomposition()) failed++;
total++; if (check_Engulfing()) failed++;
total++; if (check_Equivolume()) failed++;
total++; if (check_EstimatedLeverageRatio()) failed++;
total++; if (check_EvenBetterSinewave()) failed++;
total++; if (check_EveningDojiStar()) failed++;
total++; if (check_Evwma()) failed++;
total++; if (check_EwmaVolatility()) failed++;
total++; if (check_Expectancy()) failed++;
total++; if (check_FallingThreeMethods()) failed++;
total++; if (check_Fama()) failed++;
total++; if (check_FibArcs()) failed++;
total++; if (check_FibChannel()) failed++;
total++; if (check_FibConfluence()) failed++;
total++; if (check_FibExtension()) failed++;
total++; if (check_FibFan()) failed++;
total++; if (check_FibProjection()) failed++;
total++; if (check_FibRetracement()) failed++;
total++; if (check_FibTimeZones()) failed++;
total++; if (check_FibonacciPivots()) failed++;
total++; if (check_FisherRsi()) failed++;
total++; if (check_FisherTransform()) failed++;
total++; if (check_FlagPennant()) failed++;
total++; if (check_Footprint()) failed++;
total++; if (check_ForceIndex()) failed++;
total++; if (check_FractalChaosBands()) failed++;
total++; if (check_Frama()) failed++;
total++; if (check_FryPanBottom()) failed++;
total++; if (check_FundingBasis()) failed++;
total++; if (check_FundingImpliedApr()) failed++;
total++; if (check_FundingRate()) failed++;
total++; if (check_FundingRateMean()) failed++;
total++; if (check_FundingRateZScore()) failed++;
total++; if (check_GainLossRatio()) failed++;
total++; if (check_GainToPainRatio()) failed++;
total++; if (check_GapSideBySideWhite()) failed++;
total++; if (check_Garch11()) failed++;
total++; if (check_GarmanKlassVolatility()) failed++;
total++; if (check_Gartley()) failed++;
total++; if (check_GatorOscillator()) failed++;
total++; if (check_GeneralizedDema()) failed++;
total++; if (check_GeometricMa()) failed++;
total++; if (check_GoldenPocket()) failed++;
total++; if (check_GrangerCausality()) failed++;
total++; if (check_GravestoneDoji()) failed++;
total++; if (check_Hammer()) failed++;
total++; if (check_HangingMan()) failed++;
total++; if (check_Harami()) failed++;
total++; if (check_HaramiCross()) failed++;
total++; if (check_HasbrouckInformationShare()) failed++;
total++; if (check_HeadAndShoulders()) failed++;
total++; if (check_HeikinAshi()) failed++;
total++; if (check_HeikinAshiOscillator()) failed++;
total++; if (check_HiLoActivator()) failed++;
total++; if (check_HighLowIndex()) failed++;
total++; if (check_HighLowRange()) failed++;
total++; if (check_HighLowVolumeNodes()) failed++;
total++; if (check_HighWave()) failed++;
total++; if (check_HighpassFilter()) failed++;
total++; if (check_Hikkake()) failed++;
total++; if (check_HikkakeModified()) failed++;
total++; if (check_HilbertDominantCycle()) failed++;
total++; if (check_HistoricalVolatility()) failed++;
total++; if (check_Hma()) failed++;
total++; if (check_HoltWinters()) failed++;
total++; if (check_HomingPigeon()) failed++;
total++; if (check_HtDcPhase()) failed++;
total++; if (check_HtPhasor()) failed++;
total++; if (check_HtTrendMode()) failed++;
total++; if (check_HurstChannel()) failed++;
total++; if (check_HurstExponent()) failed++;
total++; if (check_Ichimoku()) failed++;
total++; if (check_IdenticalThreeCrows()) failed++;
total++; if (check_ImbalanceBars()) failed++;
total++; if (check_InNeck()) failed++;
total++; if (check_Inertia()) failed++;
total++; if (check_InformationRatio()) failed++;
total++; if (check_InitialBalance()) failed++;
total++; if (check_InstantaneousTrendline()) failed++;
total++; if (check_IntradayIntensity()) failed++;
total++; if (check_IntradayMomentumIndex()) failed++;
total++; if (check_IntradayVolatilityProfile()) failed++;
total++; if (check_InverseFisherTransform()) failed++;
total++; if (check_InvertedHammer()) failed++;
total++; if (check_JarqueBera()) failed++;
total++; if (check_Jma()) failed++;
total++; if (check_JumpIndicator()) failed++;
total++; if (check_KRatio()) failed++;
total++; if (check_KagiBars()) failed++;
total++; if (check_KalmanHedgeRatio()) failed++;
total++; if (check_Kama()) failed++;
total++; if (check_KaseDevStop()) failed++;
total++; if (check_KasePermissionStochastic()) failed++;
total++; if (check_KellyCriterion()) failed++;
total++; if (check_Keltner()) failed++;
total++; if (check_KendallTau()) failed++;
total++; if (check_Kicking()) failed++;
total++; if (check_KickingByLength()) failed++;
total++; if (check_Kst()) failed++;
total++; if (check_Kurtosis()) failed++;
total++; if (check_Kvo()) failed++;
total++; if (check_KylesLambda()) failed++;
total++; if (check_LadderBottom()) failed++;
total++; if (check_LaguerreRsi()) failed++;
total++; if (check_LeadLagCrossCorrelation()) failed++;
total++; if (check_LinRegAngle()) failed++;
total++; if (check_LinRegChannel()) failed++;
total++; if (check_LinRegIntercept()) failed++;
total++; if (check_LinRegSlope()) failed++;
total++; if (check_LinearRegression()) failed++;
total++; if (check_LiquidationFeatures()) failed++;
total++; if (check_LogReturn()) failed++;
total++; if (check_LongLeggedDoji()) failed++;
total++; if (check_LongLine()) failed++;
total++; if (check_LongShortRatio()) failed++;
total++; if (check_M2Measure()) failed++;
total++; if (check_MaEnvelope()) failed++;
total++; if (check_MacdExt()) failed++;
total++; if (check_MacdFix()) failed++;
total++; if (check_MacdHistogram()) failed++;
total++; if (check_MacdIndicator()) failed++;
total++; if (check_Mama()) failed++;
total++; if (check_MarketFacilitationIndex()) failed++;
total++; if (check_MartinRatio()) failed++;
total++; if (check_Marubozu()) failed++;
total++; if (check_MassIndex()) failed++;
total++; if (check_MatHold()) failed++;
total++; if (check_MatchingLow()) failed++;
total++; if (check_MaxDrawdown()) failed++;
total++; if (check_McClellanOscillator()) failed++;
total++; if (check_McClellanSummationIndex()) failed++;
total++; if (check_McGinleyDynamic()) failed++;
total++; if (check_MedianAbsoluteDeviation()) failed++;
total++; if (check_MedianChannel()) failed++;
total++; if (check_MedianMa()) failed++;
total++; if (check_MedianPrice()) failed++;
total++; if (check_Mfi()) failed++;
total++; if (check_Microprice()) failed++;
total++; if (check_MidPoint()) failed++;
total++; if (check_MidPrice()) failed++;
total++; if (check_MinusDi()) failed++;
total++; if (check_MinusDm()) failed++;
total++; if (check_ModifiedMaStop()) failed++;
total++; if (check_Mom()) failed++;
total++; if (check_MorningDojiStar()) failed++;
total++; if (check_MorningEveningStar()) failed++;
total++; if (check_MurreyMathLines()) failed++;
total++; if (check_NakedPoc()) failed++;
total++; if (check_Natr()) failed++;
total++; if (check_NewHighsNewLows()) failed++;
total++; if (check_NewPriceLines()) failed++;
total++; if (check_Nrtr()) failed++;
total++; if (check_Nvi()) failed++;
total++; if (check_OIPriceDivergence()) failed++;
total++; if (check_OIWeighted()) failed++;
total++; if (check_Obv()) failed++;
total++; if (check_OiToVolumeRatio()) failed++;
total++; if (check_OmegaRatio()) failed++;
total++; if (check_OnNeck()) failed++;
total++; if (check_OpenInterestDelta()) failed++;
total++; if (check_OpenInterestMomentum()) failed++;
total++; if (check_OpeningMarubozu()) failed++;
total++; if (check_OpeningRange()) failed++;
total++; if (check_OrderBookImbalanceFull()) failed++;
total++; if (check_OrderBookImbalanceTop1()) failed++;
total++; if (check_OrderBookImbalanceTopN()) failed++;
total++; if (check_OrderFlowImbalance()) failed++;
total++; if (check_OuHalfLife()) failed++;
total++; if (check_OvernightGap()) failed++;
total++; if (check_OvernightIntradayReturn()) failed++;
total++; if (check_PainIndex()) failed++;
total++; if (check_PairSpreadZScore()) failed++;
total++; if (check_PairwiseBeta()) failed++;
total++; if (check_ParkinsonVolatility()) failed++;
total++; if (check_PearsonCorrelation()) failed++;
total++; if (check_PercentAboveMa()) failed++;
total++; if (check_PercentB()) failed++;
total++; if (check_PercentageTrailingStop()) failed++;
total++; if (check_PerpetualPremiumIndex()) failed++;
total++; if (check_Pgo()) failed++;
total++; if (check_PiercingDarkCloud()) failed++;
total++; if (check_Pin()) failed++;
total++; if (check_PivotReversal()) failed++;
total++; if (check_PlusDi()) failed++;
total++; if (check_PlusDm()) failed++;
total++; if (check_Pmo()) failed++;
total++; if (check_PointAndFigureBars()) failed++;
total++; if (check_PolarizedFractalEfficiency()) failed++;
total++; if (check_Ppo()) failed++;
total++; if (check_PpoHistogram()) failed++;
total++; if (check_ProfileShape()) failed++;
total++; if (check_ProfitFactor()) failed++;
total++; if (check_ProjectionBands()) failed++;
total++; if (check_ProjectionOscillator()) failed++;
total++; if (check_Psar()) failed++;
total++; if (check_Pvi()) failed++;
total++; if (check_Qqe()) failed++;
total++; if (check_Qstick()) failed++;
total++; if (check_QuartileBands()) failed++;
total++; if (check_QuotedSpread()) failed++;
total++; if (check_RSquared()) failed++;
total++; if (check_RangeBars()) failed++;
total++; if (check_RealizedSpread()) failed++;
total++; if (check_RealizedVolatility()) failed++;
total++; if (check_RecoveryFactor()) failed++;
total++; if (check_RectangleRange()) failed++;
total++; if (check_Reflex()) failed++;
total++; if (check_RegimeLabel()) failed++;
total++; if (check_RelativeStrengthAB()) failed++;
total++; if (check_RenkoBars()) failed++;
total++; if (check_RenkoTrailingStop()) failed++;
total++; if (check_RickshawMan()) failed++;
total++; if (check_RisingThreeMethods()) failed++;
total++; if (check_Rmi()) failed++;
total++; if (check_Roc()) failed++;
total++; if (check_Rocp()) failed++;
total++; if (check_Rocr()) failed++;
total++; if (check_Rocr100()) failed++;
total++; if (check_RogersSatchellVolatility()) failed++;
total++; if (check_RollMeasure()) failed++;
total++; if (check_RollingCorrelation()) failed++;
total++; if (check_RollingCovariance()) failed++;
total++; if (check_RollingIqr()) failed++;
total++; if (check_RollingMinMaxScaler()) failed++;
total++; if (check_RollingPercentileRank()) failed++;
total++; if (check_RollingQuantile()) failed++;
total++; if (check_RollingVwap()) failed++;
total++; if (check_RoofingFilter()) failed++;
total++; if (check_Rsi()) failed++;
total++; if (check_Rsx()) failed++;
total++; if (check_RunBars()) failed++;
total++; if (check_Rvi()) failed++;
total++; if (check_RviVolatility()) failed++;
total++; if (check_Rwi()) failed++;
total++; if (check_SampleEntropy()) failed++;
total++; if (check_SarExt()) failed++;
total++; if (check_SeasonalZScore()) failed++;
total++; if (check_SeparatingLines()) failed++;
total++; if (check_SessionHighLow()) failed++;
total++; if (check_SessionRange()) failed++;
total++; if (check_SessionVwap()) failed++;
total++; if (check_ShannonEntropy()) failed++;
total++; if (check_Shark()) failed++;
total++; if (check_SharpeRatio()) failed++;
total++; if (check_ShootingStar()) failed++;
total++; if (check_ShortLine()) failed++;
total++; if (check_SignedVolume()) failed++;
total++; if (check_SineWave()) failed++;
total++; if (check_SineWeightedMa()) failed++;
total++; if (check_SinglePrints()) failed++;
total++; if (check_Skewness()) failed++;
total++; if (check_Sma()) failed++;
total++; if (check_Smi()) failed++;
total++; if (check_Smma()) failed++;
total++; if (check_SmoothedHeikinAshi()) failed++;
total++; if (check_SortinoRatio()) failed++;
total++; if (check_SpearmanCorrelation()) failed++;
total++; if (check_SpinningTop()) failed++;
total++; if (check_SpreadAr1Coefficient()) failed++;
total++; if (check_SpreadBollingerBands()) failed++;
total++; if (check_SpreadHurst()) failed++;
total++; if (check_StalledPattern()) failed++;
total++; if (check_StandardError()) failed++;
total++; if (check_StandardErrorBands()) failed++;
total++; if (check_StarcBands()) failed++;
total++; if (check_Stc()) failed++;
total++; if (check_StdDev()) failed++;
total++; if (check_StepTrailingStop()) failed++;
total++; if (check_SterlingRatio()) failed++;
total++; if (check_StickSandwich()) failed++;
total++; if (check_StochRsi()) failed++;
total++; if (check_Stochastic()) failed++;
total++; if (check_StochasticCci()) failed++;
total++; if (check_SuperSmoother()) failed++;
total++; if (check_SuperTrend()) failed++;
total++; if (check_T3()) failed++;
total++; if (check_TailRatio()) failed++;
total++; if (check_TakerBuySellRatio()) failed++;
total++; if (check_Takuri()) failed++;
total++; if (check_TasukiGap()) failed++;
total++; if (check_TdCamouflage()) failed++;
total++; if (check_TdClop()) failed++;
total++; if (check_TdClopwin()) failed++;
total++; if (check_TdCombo()) failed++;
total++; if (check_TdCountdown()) failed++;
total++; if (check_TdDWave()) failed++;
total++; if (check_TdDeMarker()) failed++;
total++; if (check_TdDifferential()) failed++;
total++; if (check_TdLines()) failed++;
total++; if (check_TdMovingAverage()) failed++;
total++; if (check_TdOpen()) failed++;
total++; if (check_TdPressure()) failed++;
total++; if (check_TdPropulsion()) failed++;
total++; if (check_TdRangeProjection()) failed++;
total++; if (check_TdRei()) failed++;
total++; if (check_TdRiskLevel()) failed++;
total++; if (check_TdSequential()) failed++;
total++; if (check_TdSetup()) failed++;
total++; if (check_TdTrap()) failed++;
total++; if (check_Tema()) failed++;
total++; if (check_TermStructureBasis()) failed++;
total++; if (check_ThreeDrives()) failed++;
total++; if (check_ThreeInside()) failed++;
total++; if (check_ThreeLineBreak()) failed++;
total++; if (check_ThreeLineBreakBars()) failed++;
total++; if (check_ThreeLineStrike()) failed++;
total++; if (check_ThreeOutside()) failed++;
total++; if (check_ThreeSoldiersOrCrows()) failed++;
total++; if (check_ThreeStarsInSouth()) failed++;
total++; if (check_Thrusting()) failed++;
total++; if (check_TickBars()) failed++;
total++; if (check_TickIndex()) failed++;
total++; if (check_Tii()) failed++;
total++; if (check_TimeBasedStop()) failed++;
total++; if (check_TimeOfDayReturnProfile()) failed++;
total++; if (check_TowerTopBottom()) failed++;
total++; if (check_TpoProfile()) failed++;
total++; if (check_TradeImbalance()) failed++;
total++; if (check_TradeSignAutocorrelation()) failed++;
total++; if (check_TradeVolumeIndex()) failed++;
total++; if (check_TrendLabel()) failed++;
total++; if (check_TrendStrengthIndex()) failed++;
total++; if (check_Trendflex()) failed++;
total++; if (check_TreynorRatio()) failed++;
total++; if (check_Triangle()) failed++;
total++; if (check_Trima()) failed++;
total++; if (check_Trin()) failed++;
total++; if (check_TripleTopBottom()) failed++;
total++; if (check_Tristar()) failed++;
total++; if (check_Trix()) failed++;
total++; if (check_TrueRange()) failed++;
total++; if (check_Tsf()) failed++;
total++; if (check_TsfOscillator()) failed++;
total++; if (check_Tsi()) failed++;
total++; if (check_Tsv()) failed++;
total++; if (check_TtmSqueeze()) failed++;
total++; if (check_TtmTrend()) failed++;
total++; if (check_TurnOfMonth()) failed++;
total++; if (check_Tweezer()) failed++;
total++; if (check_TwiggsMoneyFlow()) failed++;
total++; if (check_TwoCrows()) failed++;
total++; if (check_TypicalPrice()) failed++;
total++; if (check_UlcerIndex()) failed++;
total++; if (check_UltimateOscillator()) failed++;
total++; if (check_UniqueThreeRiver()) failed++;
total++; if (check_UniversalOscillator()) failed++;
total++; if (check_UpDownVolumeRatio()) failed++;
total++; if (check_UpsideGapThreeMethods()) failed++;
total++; if (check_UpsideGapTwoCrows()) failed++;
total++; if (check_UpsidePotentialRatio()) failed++;
total++; if (check_ValueArea()) failed++;
total++; if (check_ValueAtRisk()) failed++;
total++; if (check_Variance()) failed++;
total++; if (check_VarianceRatio()) failed++;
total++; if (check_VerticalHorizontalFilter()) failed++;
total++; if (check_Vidya()) failed++;
total++; if (check_VolatilityCone()) failed++;
total++; if (check_VolatilityOfVolatility()) failed++;
total++; if (check_VolatilityRatio()) failed++;
total++; if (check_VoltyStop()) failed++;
total++; if (check_VolumeBars()) failed++;
total++; if (check_VolumeByTimeProfile()) failed++;
total++; if (check_VolumeOscillator()) failed++;
total++; if (check_VolumePriceTrend()) failed++;
total++; if (check_VolumeProfile()) failed++;
total++; if (check_VolumeRsi()) failed++;
total++; if (check_VolumeWeightedMacd()) failed++;
total++; if (check_VolumeWeightedSr()) failed++;
total++; if (check_Vortex()) failed++;
total++; if (check_Vpin()) failed++;
total++; if (check_Vwap()) failed++;
total++; if (check_VwapStdDevBands()) failed++;
total++; if (check_Vwma()) failed++;
total++; if (check_Vzo()) failed++;
total++; if (check_Wad()) failed++;
total++; if (check_WavePm()) failed++;
total++; if (check_WaveTrend()) failed++;
total++; if (check_Wedge()) failed++;
total++; if (check_WeightedClose()) failed++;
total++; if (check_WickRatio()) failed++;
total++; if (check_WilliamsFractals()) failed++;
total++; if (check_WilliamsR()) failed++;
total++; if (check_WinRate()) failed++;
total++; if (check_Wma()) failed++;
total++; if (check_WoodiePivots()) failed++;
total++; if (check_YangZhangVolatility()) failed++;
total++; if (check_YoyoExit()) failed++;
total++; if (check_ZScore()) failed++;
total++; if (check_ZeroLagMacd()) failed++;
total++; if (check_ZigZag()) failed++;
total++; if (check_Zlema()) failed++;
printf("\nC/C++ golden: %d passed, %d failed (of %d)\n", total - failed, failed, total);
return failed ? 1 : 0;
}