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 @@
upper,middle,lower,stddev
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
115.28678132658357,104.88573811030453,94.4846948940255,5.200521608139521
115.44235076607696,105.24603036120507,95.04970995633319,5.098160202435939
116.031797084579,105.60667720811657,95.18155733165413,5.212559938231218
117.04307249142056,105.98012665317574,94.91718081493093,5.531472919122411
118.42198305380711,106.37768308055611,94.33338310730511,6.022149986625501
120.08275668667552,106.80849746949707,93.53423825231862,6.637129608589224
121.91875364904577,107.2787499645824,92.63874628011904,7.320001842231685
123.81164604805659,107.79109782183062,91.77054959560465,8.010274113112986
125.64023050374611,108.34443804392872,91.04864558411133,8.647896229908694
127.28963390911599,108.9340059076973,90.5783779062786,9.17781400070935
128.66054775091027,109.55180058262147,90.44305341433265,9.554373584144406
129.67757252249928,110.18729982121242,90.69702711992556,9.745136350643426
130.29572502322122,110.82839988003757,91.36107473685391,9.733662571591827
130.50437915457422,111.4624967110735,92.42061426757276,9.52094122175037
130.32821912788876,112.07761184377782,93.82700455966688,9.125303642055467
129.8251239347045,112.66346238618785,95.5018008376712,8.58083077425832
129.08124974424334,113.21237956503455,97.34350938582577,7.934435089604395
128.2039061910054,113.71999375441924,99.23608131783307,7.241956218293082
127.3130646923414,114.18562480148111,101.05818491062082,6.5637199454301465
126.53231715555998,114.61234278242675,102.69236840929352,5.959987186566614
125.97953405782138,115.00669376176606,104.03385346571073,5.486420148027664
125.75638565002856,115.37811505186531,104.99984445370205,5.18913529908163
125.9357870598765,115.73809220594023,105.54039735200396,5.098847426968135
126.54962545900983,116.09913304779411,105.64864063657839,5.225246205607857
127.5832865042029,116.47365038516884,105.36401426613477,5.55481805951703
128.98050368815137,116.87285321059787,104.76520273304435,6.053825238776757
130.6540678076189,117.3057454354863,103.9574230633537,6.674161186066302
132.49645112780993,117.77832159752104,103.06019206723217,7.359064765144439
134.3889288726604,118.29303138647245,102.19713390028451,8.047948743093972
136.21040535734892,118.84856082070294,101.48671628405697,8.680922268322988
137.8466392967716,119.43994962123331,101.03325994569502,9.20334483776914
139.19945460276048,120.05903429869099,100.9186139946215,9.570210152034747
140.1950055547042,120.69517737350274,101.19534919230128,9.749914090600733
140.79015691470516,121.33621759026396,101.88227826582275,9.7269696622206
140.97626533174446,121.96955624646452,102.9628471611846,9.503354542639963
140.77995945870256,122.58328259706207,104.38660573542157,9.098338430820245
140.2608570959882,123.16723780586335,106.07361851573852,8.54680964506242
139.5065053256598,123.71392240410584,107.9213394825519,7.896291460776974
138.62515648619677,124.21916619566703,109.8131759051373,7.202995145264866
137.7372262869952,124.68250076826405,111.62777524953292,6.527362759365569
136.96623775826222,125.10720133532797,113.24816491239372,5.929518211467127
136.42944797138296,125.49999417094236,114.57054037050175,5.464726900220303
136.22726554012488,125.87045577181189,115.51364600349889,5.178404884156497
136.43060069072433,126.230157417333,116.02971414394166,5.100221636695671
137.06878377954558,126.59163154166757,116.11447930378954,5.2385761189390125
138.12465065906432,126.9672522487239,115.80985383838346,5.578699205170216
139.53989769930303,127.36812997030788,115.19636224131273,6.085883864497572
141.22591219022797,127.80311900433938,114.38032581845077,6.711396592944301
143.07430661728296,128.27802658678937,113.48174655629578,7.398140015246793
144.9659868609782,128.79509414858606,112.62420143619393,8.085446356196067
146.77999404813113,129.35279709526566,111.92560014240019,8.713598476432734
148.40274791188529,129.9459809944551,111.48921407702495,9.228383458715081
149.7372310064368,130.56632200596493,111.39541300549307,9.585454500235931
150.7111716289501,131.2030704256427,111.69496922233529,9.7540506016537
151.2832944894774,131.8440109244297,112.40472735938202,9.719641782523846
151.44694145156345,132.47655370732554,113.50616596308762,9.485193872118952
151.2306783629382,133.08885912227984,114.94703988162149,9.070909620329171
150.69584577480683,133.67089526104846,116.64594474729007,8.51247525687919
149.93135875840417,134.21533407967942,118.49930940095467,7.858012339362374
149.04638529170163,134.71820599085441,120.39002669000722,7.1640896504236
148.16175684928777,135.17925445530142,122.19675206131508,6.491251196993171
1 upper middle lower stddev
2 nan nan nan nan
3 nan nan nan nan
4 nan nan nan nan
5 nan nan nan nan
6 nan nan nan nan
7 nan nan nan nan
8 nan nan nan nan
9 nan nan nan nan
10 nan nan nan nan
11 nan nan nan nan
12 nan nan nan nan
13 nan nan nan nan
14 nan nan nan nan
15 nan nan nan nan
16 nan nan nan nan
17 nan nan nan nan
18 nan nan nan nan
19 nan nan nan nan
20 nan nan nan nan
21 115.28678132658357 104.88573811030453 94.4846948940255 5.200521608139521
22 115.44235076607696 105.24603036120507 95.04970995633319 5.098160202435939
23 116.031797084579 105.60667720811657 95.18155733165413 5.212559938231218
24 117.04307249142056 105.98012665317574 94.91718081493093 5.531472919122411
25 118.42198305380711 106.37768308055611 94.33338310730511 6.022149986625501
26 120.08275668667552 106.80849746949707 93.53423825231862 6.637129608589224
27 121.91875364904577 107.2787499645824 92.63874628011904 7.320001842231685
28 123.81164604805659 107.79109782183062 91.77054959560465 8.010274113112986
29 125.64023050374611 108.34443804392872 91.04864558411133 8.647896229908694
30 127.28963390911599 108.9340059076973 90.5783779062786 9.17781400070935
31 128.66054775091027 109.55180058262147 90.44305341433265 9.554373584144406
32 129.67757252249928 110.18729982121242 90.69702711992556 9.745136350643426
33 130.29572502322122 110.82839988003757 91.36107473685391 9.733662571591827
34 130.50437915457422 111.4624967110735 92.42061426757276 9.52094122175037
35 130.32821912788876 112.07761184377782 93.82700455966688 9.125303642055467
36 129.8251239347045 112.66346238618785 95.5018008376712 8.58083077425832
37 129.08124974424334 113.21237956503455 97.34350938582577 7.934435089604395
38 128.2039061910054 113.71999375441924 99.23608131783307 7.241956218293082
39 127.3130646923414 114.18562480148111 101.05818491062082 6.5637199454301465
40 126.53231715555998 114.61234278242675 102.69236840929352 5.959987186566614
41 125.97953405782138 115.00669376176606 104.03385346571073 5.486420148027664
42 125.75638565002856 115.37811505186531 104.99984445370205 5.18913529908163
43 125.9357870598765 115.73809220594023 105.54039735200396 5.098847426968135
44 126.54962545900983 116.09913304779411 105.64864063657839 5.225246205607857
45 127.5832865042029 116.47365038516884 105.36401426613477 5.55481805951703
46 128.98050368815137 116.87285321059787 104.76520273304435 6.053825238776757
47 130.6540678076189 117.3057454354863 103.9574230633537 6.674161186066302
48 132.49645112780993 117.77832159752104 103.06019206723217 7.359064765144439
49 134.3889288726604 118.29303138647245 102.19713390028451 8.047948743093972
50 136.21040535734892 118.84856082070294 101.48671628405697 8.680922268322988
51 137.8466392967716 119.43994962123331 101.03325994569502 9.20334483776914
52 139.19945460276048 120.05903429869099 100.9186139946215 9.570210152034747
53 140.1950055547042 120.69517737350274 101.19534919230128 9.749914090600733
54 140.79015691470516 121.33621759026396 101.88227826582275 9.7269696622206
55 140.97626533174446 121.96955624646452 102.9628471611846 9.503354542639963
56 140.77995945870256 122.58328259706207 104.38660573542157 9.098338430820245
57 140.2608570959882 123.16723780586335 106.07361851573852 8.54680964506242
58 139.5065053256598 123.71392240410584 107.9213394825519 7.896291460776974
59 138.62515648619677 124.21916619566703 109.8131759051373 7.202995145264866
60 137.7372262869952 124.68250076826405 111.62777524953292 6.527362759365569
61 136.96623775826222 125.10720133532797 113.24816491239372 5.929518211467127
62 136.42944797138296 125.49999417094236 114.57054037050175 5.464726900220303
63 136.22726554012488 125.87045577181189 115.51364600349889 5.178404884156497
64 136.43060069072433 126.230157417333 116.02971414394166 5.100221636695671
65 137.06878377954558 126.59163154166757 116.11447930378954 5.2385761189390125
66 138.12465065906432 126.9672522487239 115.80985383838346 5.578699205170216
67 139.53989769930303 127.36812997030788 115.19636224131273 6.085883864497572
68 141.22591219022797 127.80311900433938 114.38032581845077 6.711396592944301
69 143.07430661728296 128.27802658678937 113.48174655629578 7.398140015246793
70 144.9659868609782 128.79509414858606 112.62420143619393 8.085446356196067
71 146.77999404813113 129.35279709526566 111.92560014240019 8.713598476432734
72 148.40274791188529 129.9459809944551 111.48921407702495 9.228383458715081
73 149.7372310064368 130.56632200596493 111.39541300549307 9.585454500235931
74 150.7111716289501 131.2030704256427 111.69496922233529 9.7540506016537
75 151.2832944894774 131.8440109244297 112.40472735938202 9.719641782523846
76 151.44694145156345 132.47655370732554 113.50616596308762 9.485193872118952
77 151.2306783629382 133.08885912227984 114.94703988162149 9.070909620329171
78 150.69584577480683 133.67089526104846 116.64594474729007 8.51247525687919
79 149.93135875840417 134.21533407967942 118.49930940095467 7.858012339362374
80 149.04638529170163 134.71820599085441 120.39002669000722 7.1640896504236
81 148.16175684928777 135.17925445530142 122.19675206131508 6.491251196993171