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
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
119.68877290115522,111.92763996530223,104.16650702944925
119.95803096115085,112.18594293044396,104.41385489973706
119.17956350027117,111.579227971455,103.97889244263882
117.58028788866766,110.2116460201351,102.84300415160256
115.7157688229306,108.26414601945635,100.8125232159821
113.70274128815872,105.97523290996338,98.24772453176804
111.59148367648376,103.61498585739903,95.6384880383143
109.46106536364826,101.45589752849165,93.45072969333503
107.54177422837834,99.744419526454,91.94706482452965
106.28204238866608,98.67678662192901,91.07153085519194
105.79337600475469,98.38182027242007,90.97026454008545
106.18497667366428,98.91217204168551,91.63936740970674
107.60893509218141,100.24411862671026,92.87930216123911
110.04116864067348,102.28482695973301,94.52848527879254
113.11835287049863,104.88518124371794,96.65200961693725
116.4445503391588,107.85591627894672,99.26728221873465
119.66056619479444,110.98492734070891,102.30928848662337
122.73609349334045,114.05411169916994,105.37212990499943
125.46675566920727,116.85475284237532,108.24275001554336
127.71805738190567,119.20107659186493,110.6840958018242
129.24579159941487,120.9420138925638,112.63823618571276
129.84463869138517,121.97130255662236,114.09796642185954
129.7897732088316,122.23585628238462,114.68193935593764
129.17319732234387,121.74192833606801,114.31065934979215
127.95535710644951,120.55817124638594,113.16098538632237
126.16064032449377,118.81443331786477,111.46822631123577
124.04525292584705,116.69519266620472,109.34513240656239
121.80694463715056,114.42698304047622,107.04702144380187
119.55974205320581,112.25997863861232,104.96021522401884
117.50568567673326,110.4449371922459,103.38418870775854
116.03909758514934,109.20773466108315,102.37637173701697
115.61816785985854,108.72451690723025,101.83086595460196
116.14777522224618,109.10083172226064,102.05388822227509
117.43328307619454,110.35786211323284,103.28244115027114
119.60400205885249,112.42805278964533,105.25210352043818
122.6032098656448,115.16112803254006,107.71904619943533
126.28105330513108,118.33996746241309,110.39888161969509
130.16929585508362,121.70432121481855,113.23934657455348
133.78768346870868,124.97918831867783,116.17069316864696
136.74917747586767,127.90406706544596,119.05895665502425
138.92227778593627,130.25931738333242,121.59635698072856
140.1856741645651,131.88652318440487,123.58737220424463
140.7406820315386,132.700853973726,124.6610259159134
140.46063841745726,132.69475956025894,124.92888070306063
139.63576726314676,131.93361851227115,124.23146976139553
138.41069313764635,130.54495960311132,122.6792260685763
136.7364708178502,128.7034281759981,120.67038553414604
134.63354342134116,126.61373199439691,118.59392056745267
132.329282117968,124.49344586666177,116.65760961535555
130.25419271117806,122.55694404961523,114.85969538805237
128.7301881022123,121.00107116795235,113.27195423369237
127.69835700418832,119.99265143785473,112.28694587152114
127.11586538593342,119.65770507152237,112.19954475711133
127.28239191523106,120.07232682196711,112.86226172870316
128.45677805469956,121.25551860214391,114.05425914958826
130.55610728332792,123.16470702358724,115.77330676384656
133.32432015573448,125.6950281434764,118.06573613121833
136.51799385864285,128.68354952617938,120.84910519371591
140.00418183078597,131.91931218043806,123.83444253009016
143.40972978817965,135.15940013210917,126.90907047603869
146.36301881669988,138.15028154479393,129.93754427288798
148.67967886333503,140.65260266129147,132.6255264592479
150.29187259203476,142.46669421048986,134.64151582894496
151.283215671515,143.45550176566366,135.62778785981232
151.3732406074288,143.56164444302738,135.75004827862594
150.40401172981018,142.81589900452497,135.22778627923975
148.7335621948936,141.33552924214177,133.93749628938994
146.83521760827412,139.31234580066746,131.7894739930608
144.79686145760581,136.99192178864237,129.18698211967893
142.67165603847315,134.6467145585503,126.62177307862741
140.54553304690924,132.54670455837936,124.5478760698495
138.693049423447,130.93140388844728,123.16975835344755
137.55269269227563,129.98668366489375,122.42067463751188
137.2216847295217,129.82892538370828,122.43616603789485
1 upper middle lower
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 119.68877290115522 111.92763996530223 104.16650702944925
9 119.95803096115085 112.18594293044396 104.41385489973706
10 119.17956350027117 111.579227971455 103.97889244263882
11 117.58028788866766 110.2116460201351 102.84300415160256
12 115.7157688229306 108.26414601945635 100.8125232159821
13 113.70274128815872 105.97523290996338 98.24772453176804
14 111.59148367648376 103.61498585739903 95.6384880383143
15 109.46106536364826 101.45589752849165 93.45072969333503
16 107.54177422837834 99.744419526454 91.94706482452965
17 106.28204238866608 98.67678662192901 91.07153085519194
18 105.79337600475469 98.38182027242007 90.97026454008545
19 106.18497667366428 98.91217204168551 91.63936740970674
20 107.60893509218141 100.24411862671026 92.87930216123911
21 110.04116864067348 102.28482695973301 94.52848527879254
22 113.11835287049863 104.88518124371794 96.65200961693725
23 116.4445503391588 107.85591627894672 99.26728221873465
24 119.66056619479444 110.98492734070891 102.30928848662337
25 122.73609349334045 114.05411169916994 105.37212990499943
26 125.46675566920727 116.85475284237532 108.24275001554336
27 127.71805738190567 119.20107659186493 110.6840958018242
28 129.24579159941487 120.9420138925638 112.63823618571276
29 129.84463869138517 121.97130255662236 114.09796642185954
30 129.7897732088316 122.23585628238462 114.68193935593764
31 129.17319732234387 121.74192833606801 114.31065934979215
32 127.95535710644951 120.55817124638594 113.16098538632237
33 126.16064032449377 118.81443331786477 111.46822631123577
34 124.04525292584705 116.69519266620472 109.34513240656239
35 121.80694463715056 114.42698304047622 107.04702144380187
36 119.55974205320581 112.25997863861232 104.96021522401884
37 117.50568567673326 110.4449371922459 103.38418870775854
38 116.03909758514934 109.20773466108315 102.37637173701697
39 115.61816785985854 108.72451690723025 101.83086595460196
40 116.14777522224618 109.10083172226064 102.05388822227509
41 117.43328307619454 110.35786211323284 103.28244115027114
42 119.60400205885249 112.42805278964533 105.25210352043818
43 122.6032098656448 115.16112803254006 107.71904619943533
44 126.28105330513108 118.33996746241309 110.39888161969509
45 130.16929585508362 121.70432121481855 113.23934657455348
46 133.78768346870868 124.97918831867783 116.17069316864696
47 136.74917747586767 127.90406706544596 119.05895665502425
48 138.92227778593627 130.25931738333242 121.59635698072856
49 140.1856741645651 131.88652318440487 123.58737220424463
50 140.7406820315386 132.700853973726 124.6610259159134
51 140.46063841745726 132.69475956025894 124.92888070306063
52 139.63576726314676 131.93361851227115 124.23146976139553
53 138.41069313764635 130.54495960311132 122.6792260685763
54 136.7364708178502 128.7034281759981 120.67038553414604
55 134.63354342134116 126.61373199439691 118.59392056745267
56 132.329282117968 124.49344586666177 116.65760961535555
57 130.25419271117806 122.55694404961523 114.85969538805237
58 128.7301881022123 121.00107116795235 113.27195423369237
59 127.69835700418832 119.99265143785473 112.28694587152114
60 127.11586538593342 119.65770507152237 112.19954475711133
61 127.28239191523106 120.07232682196711 112.86226172870316
62 128.45677805469956 121.25551860214391 114.05425914958826
63 130.55610728332792 123.16470702358724 115.77330676384656
64 133.32432015573448 125.6950281434764 118.06573613121833
65 136.51799385864285 128.68354952617938 120.84910519371591
66 140.00418183078597 131.91931218043806 123.83444253009016
67 143.40972978817965 135.15940013210917 126.90907047603869
68 146.36301881669988 138.15028154479393 129.93754427288798
69 148.67967886333503 140.65260266129147 132.6255264592479
70 150.29187259203476 142.46669421048986 134.64151582894496
71 151.283215671515 143.45550176566366 135.62778785981232
72 151.3732406074288 143.56164444302738 135.75004827862594
73 150.40401172981018 142.81589900452497 135.22778627923975
74 148.7335621948936 141.33552924214177 133.93749628938994
75 146.83521760827412 139.31234580066746 131.7894739930608
76 144.79686145760581 136.99192178864237 129.18698211967893
77 142.67165603847315 134.6467145585503 126.62177307862741
78 140.54553304690924 132.54670455837936 124.5478760698495
79 138.693049423447 130.93140388844728 123.16975835344755
80 137.55269269227563 129.98668366489375 122.42067463751188
81 137.2216847295217 129.82892538370828 122.43616603789485