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 @@
open,high,low,close
99.5,101,98,99.5
99.5,104.77731091023225,99.5,103.0164107856682
101.2582053928341,108.13914959894458,101.2582053928341,106.37627358101629
103.81723948692519,110.76487377959927,103.81723948692519,109.29790049544098
106.55756999118309,112.90403177129735,106.55756999118309,111.52846427794583
109.04301713456445,114.45148509543229,109.04301713456445,112.875521673814
110.95926940418923,115.1642566915892,110.95926940418923,113.23347255708218
112.0963709806357,114.55977666009171,110.64086736017657,112.60032201013415
112.34834649538493,112.72390874531129,109.43899848657534,111.08145361594332
111.71490005566412,111.71490005566412,107.76539185209613,108.8791967020537
110.2970483788589,110.2970483788589,104.79904459577605,106.26936898786705
108.28320868336297,108.28320868336297,101.71978916733775,103.56820817142187
105.92570842739242,105.92570842739242,99.18732582635697,101.0947104237263
103.51020942555937,103.51020942555937,97.48620160125755,99.13404459529625
101.3221270104278,101.3221270104278,96.34710045689485,97.90729114869247
99.61470907956013,99.61470907956013,95.93821562552817,97.55138116443152
98.58304512199582,99.67344281002588,96.54876504706593,98.1111039285459
98.34707452527087,101.15293363552601,97.93278462060415,99.54285912806507
98.94496682666798,103.20029690993537,98.94496682666798,101.72792025538247
100.33644354102523,106.32510161131832,100.33644354102523,104.49173065212182
102.41408709657352,109.54022022493461,102.41408709657352,107.62538078254896
105.01973393956123,112.56654934841096,105.01973393956123,110.90590746884149
107.96282070420136,115.26697281350663,107.96282070420136,114.11320078613974
111.03801074517055,118.47543335247398,111.03801074517055,117.0427452645055
114.04037800483803,121.38046215528227,114.04037800483803,119.51475165912528
116.77756483198166,123.36781277048146,116.77756483198166,121.3811006281581
119.07933273006988,124.2878498649492,119.07933273006988,122.53171006302097
120.80552139654543,124.22410945235427,120.80552139654543,122.90143777679592
121.85347958667067,123.88697089091687,121.06827005264091,122.47762047177889
122.16555002922479,122.98099977052848,119.63330909790388,121.30715443421617
121.73635223172047,121.73635223172047,117.70285703314954,119.50102880884698
120.61869052028374,120.61869052028374,115.60101790940676,117.23377096648008
118.92623074338191,118.92623074338191,113.05795434620948,114.73556192793188
116.83089633565689,116.83089633565689,110.47704737833695,112.27583959099815
114.55336796332752,114.55336796332752,108.51535390119264,110.13883479309037
112.34610137820894,112.34610137820894,107.18792367213928,108.59332241867756
110.46971189844325,110.46971189844325,106.49671695482826,107.86047934521304
109.16509562182814,109.90155645208623,106.26786689008574,108.08471167108598
108.62490364645706,111.30403713029216,107.32068773822765,109.31236243425991
108.96863304035848,113.29382811110736,108.96863304035848,111.4822566759027
110.2254448581306,115.76972371414958,110.2254448581306,114.43022978908895
112.32783732360977,119.15370942824079,112.32783732360977,117.90746386998124
115.1176505967955,123.33523703654073,115.1176505967955,121.6100951023235
118.3638728495595,127.14038418498515,118.3638728495595,125.21564025514759
121.78975655235354,130.20955349568973,121.78975655235354,128.42071556026957
125.10523605631155,132.45313613345562,125.10523605631155,130.97449658556297
128.03986632093728,134.3228744433646,128.03986632093728,132.70337320460774
130.37161976277253,135.053120145851,130.37161976277253,133.52404653447638
131.94783314862445,135.065460892756,131.8235156308926,133.4444882618243
132.69616070522437,134.08480947785137,131.0237176510951,132.55426356447325
132.62521213484882,132.71696973631924,129.29758425495962,131.00727699563942
131.81624456524412,131.81624456524412,127.07925728332546,129.00074817527417
130.40849637025914,130.40849637025914,124.94895708842891,126.75407686183011
128.58128661604462,128.58128661604462,123.1073244542458,124.49034662606454
126.53581662105458,126.53581662105458,121.2254215875191,122.42184954038225
124.47883308071842,124.47883308071842,119.02315927992295,120.73959006069859
122.60921157070851,122.60921157070851,117.62555095473105,119.60563259734175
121.10742208402513,121.10742208402513,117.25536324735009,119.14667258704391
120.12704733553451,120.94065716085713,117.95421275941922,119.44743496013818
119.78724114783634,121.93415307848436,119.152517136663,120.54333510757368
120.16528812770501,123.94838830624106,120.16528812770501,122.41300180733944
121.28914496752222,126.75625008370868,121.28914496752222,124.9723861156795
123.13076554160085,129.80523536741393,123.13076554160085,128.0728922037315
125.60182887266618,133.06294250948164,125.60182887266618,131.50599292428956
128.55391089847785,136.79793765689536,128.55391089847785,135.0160376079457
131.78497425321177,140.0546941334019,131.78497425321177,138.3215327770725
135.05325351514213,142.5489901806554,135.05325351514213,141.14337574868256
138.09831463191233,144.5932922665057,138.09831463191233,143.23676289844406
140.6675387651782,146.0756620034572,140.6675387651782,144.42221413881902
142.54487645199862,146.57143212166807,142.54487645199862,144.61070035874553
143.57778840537208,145.7471249168318,141.88968005898082,143.81840248790633
143.6980954466392,143.72992039092952,140.60631434563564,142.16811736828257
142.93310640746088,142.93310640746088,138.7454488027266,139.8764867613631
141.404796584412,141.404796584412,135.67655244818158,137.22863145779047
139.31671402110123,139.31671402110123,132.66155074344638,134.54392876795973
136.9303213945305,136.9303213945305,130.25415962109273,132.13813355498985
134.53422747476017,134.53422747476017,128.70717960530897,130.28751561753393
132.41087154614706,132.41087154614706,127.6154547134165,129.20009166687123
130.80548160650915,130.80548160650915,127.39947545719488,128.99752295261356
129.90150227956136,131.29749357237068,128.12086294416926,129.70917825826996
1 open high low close
2 99.5 101 98 99.5
3 99.5 104.77731091023225 99.5 103.0164107856682
4 101.2582053928341 108.13914959894458 101.2582053928341 106.37627358101629
5 103.81723948692519 110.76487377959927 103.81723948692519 109.29790049544098
6 106.55756999118309 112.90403177129735 106.55756999118309 111.52846427794583
7 109.04301713456445 114.45148509543229 109.04301713456445 112.875521673814
8 110.95926940418923 115.1642566915892 110.95926940418923 113.23347255708218
9 112.0963709806357 114.55977666009171 110.64086736017657 112.60032201013415
10 112.34834649538493 112.72390874531129 109.43899848657534 111.08145361594332
11 111.71490005566412 111.71490005566412 107.76539185209613 108.8791967020537
12 110.2970483788589 110.2970483788589 104.79904459577605 106.26936898786705
13 108.28320868336297 108.28320868336297 101.71978916733775 103.56820817142187
14 105.92570842739242 105.92570842739242 99.18732582635697 101.0947104237263
15 103.51020942555937 103.51020942555937 97.48620160125755 99.13404459529625
16 101.3221270104278 101.3221270104278 96.34710045689485 97.90729114869247
17 99.61470907956013 99.61470907956013 95.93821562552817 97.55138116443152
18 98.58304512199582 99.67344281002588 96.54876504706593 98.1111039285459
19 98.34707452527087 101.15293363552601 97.93278462060415 99.54285912806507
20 98.94496682666798 103.20029690993537 98.94496682666798 101.72792025538247
21 100.33644354102523 106.32510161131832 100.33644354102523 104.49173065212182
22 102.41408709657352 109.54022022493461 102.41408709657352 107.62538078254896
23 105.01973393956123 112.56654934841096 105.01973393956123 110.90590746884149
24 107.96282070420136 115.26697281350663 107.96282070420136 114.11320078613974
25 111.03801074517055 118.47543335247398 111.03801074517055 117.0427452645055
26 114.04037800483803 121.38046215528227 114.04037800483803 119.51475165912528
27 116.77756483198166 123.36781277048146 116.77756483198166 121.3811006281581
28 119.07933273006988 124.2878498649492 119.07933273006988 122.53171006302097
29 120.80552139654543 124.22410945235427 120.80552139654543 122.90143777679592
30 121.85347958667067 123.88697089091687 121.06827005264091 122.47762047177889
31 122.16555002922479 122.98099977052848 119.63330909790388 121.30715443421617
32 121.73635223172047 121.73635223172047 117.70285703314954 119.50102880884698
33 120.61869052028374 120.61869052028374 115.60101790940676 117.23377096648008
34 118.92623074338191 118.92623074338191 113.05795434620948 114.73556192793188
35 116.83089633565689 116.83089633565689 110.47704737833695 112.27583959099815
36 114.55336796332752 114.55336796332752 108.51535390119264 110.13883479309037
37 112.34610137820894 112.34610137820894 107.18792367213928 108.59332241867756
38 110.46971189844325 110.46971189844325 106.49671695482826 107.86047934521304
39 109.16509562182814 109.90155645208623 106.26786689008574 108.08471167108598
40 108.62490364645706 111.30403713029216 107.32068773822765 109.31236243425991
41 108.96863304035848 113.29382811110736 108.96863304035848 111.4822566759027
42 110.2254448581306 115.76972371414958 110.2254448581306 114.43022978908895
43 112.32783732360977 119.15370942824079 112.32783732360977 117.90746386998124
44 115.1176505967955 123.33523703654073 115.1176505967955 121.6100951023235
45 118.3638728495595 127.14038418498515 118.3638728495595 125.21564025514759
46 121.78975655235354 130.20955349568973 121.78975655235354 128.42071556026957
47 125.10523605631155 132.45313613345562 125.10523605631155 130.97449658556297
48 128.03986632093728 134.3228744433646 128.03986632093728 132.70337320460774
49 130.37161976277253 135.053120145851 130.37161976277253 133.52404653447638
50 131.94783314862445 135.065460892756 131.8235156308926 133.4444882618243
51 132.69616070522437 134.08480947785137 131.0237176510951 132.55426356447325
52 132.62521213484882 132.71696973631924 129.29758425495962 131.00727699563942
53 131.81624456524412 131.81624456524412 127.07925728332546 129.00074817527417
54 130.40849637025914 130.40849637025914 124.94895708842891 126.75407686183011
55 128.58128661604462 128.58128661604462 123.1073244542458 124.49034662606454
56 126.53581662105458 126.53581662105458 121.2254215875191 122.42184954038225
57 124.47883308071842 124.47883308071842 119.02315927992295 120.73959006069859
58 122.60921157070851 122.60921157070851 117.62555095473105 119.60563259734175
59 121.10742208402513 121.10742208402513 117.25536324735009 119.14667258704391
60 120.12704733553451 120.94065716085713 117.95421275941922 119.44743496013818
61 119.78724114783634 121.93415307848436 119.152517136663 120.54333510757368
62 120.16528812770501 123.94838830624106 120.16528812770501 122.41300180733944
63 121.28914496752222 126.75625008370868 121.28914496752222 124.9723861156795
64 123.13076554160085 129.80523536741393 123.13076554160085 128.0728922037315
65 125.60182887266618 133.06294250948164 125.60182887266618 131.50599292428956
66 128.55391089847785 136.79793765689536 128.55391089847785 135.0160376079457
67 131.78497425321177 140.0546941334019 131.78497425321177 138.3215327770725
68 135.05325351514213 142.5489901806554 135.05325351514213 141.14337574868256
69 138.09831463191233 144.5932922665057 138.09831463191233 143.23676289844406
70 140.6675387651782 146.0756620034572 140.6675387651782 144.42221413881902
71 142.54487645199862 146.57143212166807 142.54487645199862 144.61070035874553
72 143.57778840537208 145.7471249168318 141.88968005898082 143.81840248790633
73 143.6980954466392 143.72992039092952 140.60631434563564 142.16811736828257
74 142.93310640746088 142.93310640746088 138.7454488027266 139.8764867613631
75 141.404796584412 141.404796584412 135.67655244818158 137.22863145779047
76 139.31671402110123 139.31671402110123 132.66155074344638 134.54392876795973
77 136.9303213945305 136.9303213945305 130.25415962109273 132.13813355498985
78 134.53422747476017 134.53422747476017 128.70717960530897 130.28751561753393
79 132.41087154614706 132.41087154614706 127.6154547134165 129.20009166687123
80 130.80548160650915 130.80548160650915 127.39947545719488 128.99752295261356
81 129.90150227956136 131.29749357237068 128.12086294416926 129.70917825826996