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
This commit is contained in:
kingchenc
2026-06-15 04:48:51 +02:00
committed by GitHub
parent de1112ea91
commit 4f708d410d
573 changed files with 102337 additions and 77 deletions
+81
View File
@@ -0,0 +1,81 @@
macd,signal,histogram
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
3.553825374871522,4.7567646581597245,-1.2029392832882024
2.8208654161048656,4.369584809748753,-1.5487193936438874
2.1109014543067843,3.9178481386603594,-1.806946684353575
1.4897304373886868,3.4322245984060253,-1.9424941610173385
1.0151049910054155,2.9488006769259036,-1.9336956859204881
0.7315731385597957,2.5053551692526823,-1.7737820306928866
0.6664991548332893,2.137583966368804,-1.4710848115355146
0.8276206486027746,1.8755913028155982,-1.0479706542128235
1.2023598043004569,1.74094500311257,-0.5385851988121131
1.7589500704087442,1.744546016571805,0.014404053836939212
2.449277456832604,1.885492304623965,0.563785152208639
3.2131824784813148,2.1510303393954353,1.0621521390858795
3.9838383370451567,2.5175919389253796,1.466246398119777
4.693724820711168,2.9528185152825377,1.7409063054286302
5.280664208546995,3.418387653935429,1.8622765546115656
5.693379944743711,3.8733861120970854,1.8199938326466256
5.896081491642136,4.277925188006096,1.6181563036360398
5.871665770714699,4.596673304547816,1.274992466166883
5.623249186369037,4.801988480912061,0.821260705456976
5.17389335937969,4.876369456605587,0.29752390277410345
4.564549053715282,4.814005376027526,-0.2494563223122439
3.8504019492156516,4.621284690665152,-0.7708827414495003
3.0959466751243525,4.316217087556993,-1.2202704124326402
2.369229123514458,3.926819494748486,-1.5575903712340278
1.735771359392487,3.488609867677286,-1.7528385082847988
1.252721799050505,3.0414322539519296,-1.7887104549014246
0.9637532073126067,2.6258964446240656,-1.6621432373114589
0.8951642651140048,2.2797500087220537,-1.3845857436080489
1.0535329484060725,2.0345065966588574,-0.9809736482527849
1.4251313413431745,1.9126315455957208,-0.48750020425254625
1.9771541634642489,1.9255360691694265,0.051618094294822336
2.6606512771767967,2.072559110770901,0.5880921664058958
3.414902230493496,2.34102773471542,1.073874495778076
4.17284207727586,2.707390603227508,1.4654514740483515
4.867053809684606,3.139323244518928,1.727730565165678
5.4357921236225195,3.5986170203396464,1.8371751032828731
5.828500438890558,4.044593704049829,1.7839067348407287
6.010328361604678,4.437740635560799,1.5725877260438788
5.965246063689932,4.743241721186626,1.2220043425033058
5.697477387222705,4.934088854393842,0.7633885328288628
5.231123664416998,4.9934958163984735,0.23762784801852455
4.608011861752942,4.916399025469367,-0.30838716371642505
3.883959272298,4.709911074835094,-0.8259518025370935
3.123788425025225,4.39268654487312,-1.2688981198478952
2.395537519050208,3.993256739708538,-1.59771922065833
1.764383551803462,3.547482102127523,-1.7830985503240608
1.286820974089835,3.0953498765199856,-1.8085289024301505
1 macd signal histogram
2 nan nan nan
3 nan nan nan
4 nan nan nan
5 nan nan nan
6 nan nan nan
7 nan nan nan
8 nan nan nan
9 nan nan nan
10 nan nan nan
11 nan nan nan
12 nan nan nan
13 nan nan nan
14 nan nan nan
15 nan nan nan
16 nan nan nan
17 nan nan nan
18 nan nan nan
19 nan nan nan
20 nan nan nan
21 nan nan nan
22 nan nan nan
23 nan nan nan
24 nan nan nan
25 nan nan nan
26 nan nan nan
27 nan nan nan
28 nan nan nan
29 nan nan nan
30 nan nan nan
31 nan nan nan
32 nan nan nan
33 nan nan nan
34 nan nan nan
35 3.553825374871522 4.7567646581597245 -1.2029392832882024
36 2.8208654161048656 4.369584809748753 -1.5487193936438874
37 2.1109014543067843 3.9178481386603594 -1.806946684353575
38 1.4897304373886868 3.4322245984060253 -1.9424941610173385
39 1.0151049910054155 2.9488006769259036 -1.9336956859204881
40 0.7315731385597957 2.5053551692526823 -1.7737820306928866
41 0.6664991548332893 2.137583966368804 -1.4710848115355146
42 0.8276206486027746 1.8755913028155982 -1.0479706542128235
43 1.2023598043004569 1.74094500311257 -0.5385851988121131
44 1.7589500704087442 1.744546016571805 0.014404053836939212
45 2.449277456832604 1.885492304623965 0.563785152208639
46 3.2131824784813148 2.1510303393954353 1.0621521390858795
47 3.9838383370451567 2.5175919389253796 1.466246398119777
48 4.693724820711168 2.9528185152825377 1.7409063054286302
49 5.280664208546995 3.418387653935429 1.8622765546115656
50 5.693379944743711 3.8733861120970854 1.8199938326466256
51 5.896081491642136 4.277925188006096 1.6181563036360398
52 5.871665770714699 4.596673304547816 1.274992466166883
53 5.623249186369037 4.801988480912061 0.821260705456976
54 5.17389335937969 4.876369456605587 0.29752390277410345
55 4.564549053715282 4.814005376027526 -0.2494563223122439
56 3.8504019492156516 4.621284690665152 -0.7708827414495003
57 3.0959466751243525 4.316217087556993 -1.2202704124326402
58 2.369229123514458 3.926819494748486 -1.5575903712340278
59 1.735771359392487 3.488609867677286 -1.7528385082847988
60 1.252721799050505 3.0414322539519296 -1.7887104549014246
61 0.9637532073126067 2.6258964446240656 -1.6621432373114589
62 0.8951642651140048 2.2797500087220537 -1.3845857436080489
63 1.0535329484060725 2.0345065966588574 -0.9809736482527849
64 1.4251313413431745 1.9126315455957208 -0.48750020425254625
65 1.9771541634642489 1.9255360691694265 0.051618094294822336
66 2.6606512771767967 2.072559110770901 0.5880921664058958
67 3.414902230493496 2.34102773471542 1.073874495778076
68 4.17284207727586 2.707390603227508 1.4654514740483515
69 4.867053809684606 3.139323244518928 1.727730565165678
70 5.4357921236225195 3.5986170203396464 1.8371751032828731
71 5.828500438890558 4.044593704049829 1.7839067348407287
72 6.010328361604678 4.437740635560799 1.5725877260438788
73 5.965246063689932 4.743241721186626 1.2220043425033058
74 5.697477387222705 4.934088854393842 0.7633885328288628
75 5.231123664416998 4.9934958163984735 0.23762784801852455
76 4.608011861752942 4.916399025469367 -0.30838716371642505
77 3.883959272298 4.709911074835094 -0.8259518025370935
78 3.123788425025225 4.39268654487312 -1.2688981198478952
79 2.395537519050208 3.993256739708538 -1.59771922065833
80 1.764383551803462 3.547482102127523 -1.7830985503240608
81 1.286820974089835 3.0953498765199856 -1.8085289024301505