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 @@
high,low,breakout_distance
101,98,0.5
104.77731091023225,98,2.066546611497273
108.13914959894458,98,3.576849934478062
110.76487377959927,98,4.950832206475198
112.90403177129735,98,5.868374974023581
114.45148509543229,98,6.249207318324395
115.1642566915892,98,6.156347962987354
115.1642566915892,98,5.549965320694142
115.1642566915892,98,4.172503459716907
115.1642566915892,98,2.1916704565437044
115.1642566915892,98,-0.17092826519592563
115.1642566915892,98,-2.659585287227088
115.1642566915892,98,-5.00733277874312
115.1642566915892,97.48620160125755,-6.7028907382631076
115.1642566915892,97.48620160125755,-8.040986870559252
115.1642566915892,97.48620160125755,-8.600530323074338
115.1642566915892,97.48620160125755,-8.286875234781775
115.1642566915892,97.48620160125755,-7.083375969700697
115.1642566915892,97.48620160125755,-5.052874021983243
115.1642566915892,97.48620160125755,-2.3320845723997365
115.1642566915892,97.48620160125755,0.8806158715873664
115.1642566915892,97.48620160125755,4.342909858420128
115.1642566915892,97.48620160125755,7.790184488710409
115.1642566915892,97.48620160125755,10.95916849745862
115.1642566915892,97.48620160125755,13.61144949206816
115.1642566915892,97.48620160125755,15.554770621324025
115.1642566915892,97.48620160125755,16.660204307322687
115.1642566915892,97.48620160125755,16.873668962027494
115.1642566915892,97.48620160125755,16.220759934459437
115.1642566915892,97.48620160125755,14.804463154398462
115.1642566915892,97.48620160125755,12.795955705994203
115.1642566915892,97.48620160125755,10.419315088647267
115.1642566915892,97.48620160125755,7.931503041346829
115.1642566915892,97.48620160125755,5.599411915823424
115.1642566915892,97.48620160125755,3.676023977641208
115.1642566915892,97.48620160125755,2.3778132538599266
115.1642566915892,97.48620160125755,1.8654085529117168
115.1642566915892,97.48620160125755,2.229244971536744
115.1642566915892,97.48620160125755,3.481485596929872
115.1642566915892,97.48620160125755,5.554935014386302
115.1642566915892,97.48620160125755,8.309041673572281
115.1642566915892,97.48620160125755,11.542452939918604
115.1642566915892,97.48620160125755,15.011001325788001
115.1642566915892,97.48620160125755,18.44951524495356
115.1642566915892,97.48620160125755,21.595506000648868
115.1642566915892,97.48620160125755,24.212615119092845
115.1642566915892,97.48620160125755,26.111727548017683
115.1642566915892,97.48620160125755,27.16786474105581
115.1642566915892,97.48620160125755,27.331348619069416
115.1642566915892,97.48620160125755,26.632239165005984
115.1642566915892,97.48620160125755,25.1776492551478
115.1642566915892,97.48620160125755,23.142176584882776
115.1642566915892,97.48620160125755,20.752307376571068
115.1642566915892,97.48620160125755,18.266185039834753
115.1642566915892,97.48620160125755,15.950550989591974
115.1642566915892,97.48620160125755,14.056917429885402
115.1642566915892,97.48620160125755,12.799100517761588
115.1642566915892,97.48620160125755,12.33412080276021
115.1642566915892,97.48620160125755,12.748177048870303
115.1642566915892,97.48620160125755,14.048946355664782
115.1642566915892,97.48620160125755,16.16489838585987
115.1642566915892,97.48620160125755,18.95168495730931
115.1642566915892,97.48620160125755,22.205034236210395
115.1642566915892,97.48620160125755,25.678997731644728
115.1642566915892,97.48620160125755,29.107920141775566
115.1642566915892,97.48620160125755,32.230169550772644
115.1642566915892,97.48620160125755,34.81150822864768
115.1642566915892,97.48620160125755,36.666016390055574
115.1642566915892,97.48620160125755,37.672699855003344
115.1642566915892,97.48620160125755,37.7862980985978
115.1642566915892,97.48620160125755,37.041327238937185
115.1642566915892,97.48620160125755,35.54899681507902
115.1642566915892,97.48620160125755,33.48727577012605
115.1642566915892,97.48620160125755,31.084995015575117
115.1642566915892,97.48620160125755,28.601406647509037
115.1642566915892,97.48620160125755,26.303025728971534
115.1642566915892,97.48620160125755,24.439823293134197
115.1642566915892,97.48620160125755,23.222897175379813
115.1642566915892,97.48620160125755,22.805615272370147
115.1642566915892,97.48620160125755,23.26991564460505
1 high low breakout_distance
2 101 98 0.5
3 104.77731091023225 98 2.066546611497273
4 108.13914959894458 98 3.576849934478062
5 110.76487377959927 98 4.950832206475198
6 112.90403177129735 98 5.868374974023581
7 114.45148509543229 98 6.249207318324395
8 115.1642566915892 98 6.156347962987354
9 115.1642566915892 98 5.549965320694142
10 115.1642566915892 98 4.172503459716907
11 115.1642566915892 98 2.1916704565437044
12 115.1642566915892 98 -0.17092826519592563
13 115.1642566915892 98 -2.659585287227088
14 115.1642566915892 98 -5.00733277874312
15 115.1642566915892 97.48620160125755 -6.7028907382631076
16 115.1642566915892 97.48620160125755 -8.040986870559252
17 115.1642566915892 97.48620160125755 -8.600530323074338
18 115.1642566915892 97.48620160125755 -8.286875234781775
19 115.1642566915892 97.48620160125755 -7.083375969700697
20 115.1642566915892 97.48620160125755 -5.052874021983243
21 115.1642566915892 97.48620160125755 -2.3320845723997365
22 115.1642566915892 97.48620160125755 0.8806158715873664
23 115.1642566915892 97.48620160125755 4.342909858420128
24 115.1642566915892 97.48620160125755 7.790184488710409
25 115.1642566915892 97.48620160125755 10.95916849745862
26 115.1642566915892 97.48620160125755 13.61144949206816
27 115.1642566915892 97.48620160125755 15.554770621324025
28 115.1642566915892 97.48620160125755 16.660204307322687
29 115.1642566915892 97.48620160125755 16.873668962027494
30 115.1642566915892 97.48620160125755 16.220759934459437
31 115.1642566915892 97.48620160125755 14.804463154398462
32 115.1642566915892 97.48620160125755 12.795955705994203
33 115.1642566915892 97.48620160125755 10.419315088647267
34 115.1642566915892 97.48620160125755 7.931503041346829
35 115.1642566915892 97.48620160125755 5.599411915823424
36 115.1642566915892 97.48620160125755 3.676023977641208
37 115.1642566915892 97.48620160125755 2.3778132538599266
38 115.1642566915892 97.48620160125755 1.8654085529117168
39 115.1642566915892 97.48620160125755 2.229244971536744
40 115.1642566915892 97.48620160125755 3.481485596929872
41 115.1642566915892 97.48620160125755 5.554935014386302
42 115.1642566915892 97.48620160125755 8.309041673572281
43 115.1642566915892 97.48620160125755 11.542452939918604
44 115.1642566915892 97.48620160125755 15.011001325788001
45 115.1642566915892 97.48620160125755 18.44951524495356
46 115.1642566915892 97.48620160125755 21.595506000648868
47 115.1642566915892 97.48620160125755 24.212615119092845
48 115.1642566915892 97.48620160125755 26.111727548017683
49 115.1642566915892 97.48620160125755 27.16786474105581
50 115.1642566915892 97.48620160125755 27.331348619069416
51 115.1642566915892 97.48620160125755 26.632239165005984
52 115.1642566915892 97.48620160125755 25.1776492551478
53 115.1642566915892 97.48620160125755 23.142176584882776
54 115.1642566915892 97.48620160125755 20.752307376571068
55 115.1642566915892 97.48620160125755 18.266185039834753
56 115.1642566915892 97.48620160125755 15.950550989591974
57 115.1642566915892 97.48620160125755 14.056917429885402
58 115.1642566915892 97.48620160125755 12.799100517761588
59 115.1642566915892 97.48620160125755 12.33412080276021
60 115.1642566915892 97.48620160125755 12.748177048870303
61 115.1642566915892 97.48620160125755 14.048946355664782
62 115.1642566915892 97.48620160125755 16.16489838585987
63 115.1642566915892 97.48620160125755 18.95168495730931
64 115.1642566915892 97.48620160125755 22.205034236210395
65 115.1642566915892 97.48620160125755 25.678997731644728
66 115.1642566915892 97.48620160125755 29.107920141775566
67 115.1642566915892 97.48620160125755 32.230169550772644
68 115.1642566915892 97.48620160125755 34.81150822864768
69 115.1642566915892 97.48620160125755 36.666016390055574
70 115.1642566915892 97.48620160125755 37.672699855003344
71 115.1642566915892 97.48620160125755 37.7862980985978
72 115.1642566915892 97.48620160125755 37.041327238937185
73 115.1642566915892 97.48620160125755 35.54899681507902
74 115.1642566915892 97.48620160125755 33.48727577012605
75 115.1642566915892 97.48620160125755 31.084995015575117
76 115.1642566915892 97.48620160125755 28.601406647509037
77 115.1642566915892 97.48620160125755 26.303025728971534
78 115.1642566915892 97.48620160125755 24.439823293134197
79 115.1642566915892 97.48620160125755 23.222897175379813
80 115.1642566915892 97.48620160125755 22.805615272370147
81 115.1642566915892 97.48620160125755 23.26991564460505