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
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
nan,nan,nan
112.00454229927934,107.082865308575,102.1633636879963
111.903996698001,106.96031118542241,102.03702207594756
111.48149095236647,106.55098952518925,101.67783115273905
110.84753008292738,105.93612732359576,101.12981477034926
110.1823135395352,105.21531190077062,100.40326913125591
109.5036401798982,104.49759506253974,99.68310613110404
108.96140873233165,103.89175182739567,99.03055716743253
108.55757771159065,103.49656387805487,98.63355958617213
108.37119784452737,103.39199568793734,98.57524233498944
108.48123056464149,103.63205153291037,98.8947106702469
109.13355090120591,104.23995145016349,99.41036676194948
110.16562981720305,105.20605706144154,100.27299449048978
111.46754612622676,106.48873254066868,101.51564231169665
112.96480536016107,108.01806381828972,103.07772074367713
114.59091724799116,109.7021037968819,104.84319176799882
116.31238287778524,111.4350857115261,106.62930322893273
118.02171523469391,113.10687095991703,108.31262995838041
119.60041387832072,114.61278745568676,109.79025736162829
120.86843833251953,115.86297967414018,111.04856243742181
121.84199343121688,116.79043517866376,111.93416142447509
122.39011307800129,117.35697064210828,112.49710053406037
122.50576329657846,117.55664264968355,112.73761870284666
122.28492982985878,117.41627860650068,112.6261751502832
121.88410160023147,116.99308032537222,112.13535105079109
121.32841892406745,116.36951435923494,111.41502979189917
120.62769249435505,115.64594550958222,110.66031870509737
119.88266208381762,114.93167153765809,109.99034859761083
119.21334803236513,114.33515992096163,109.49959706481589
118.84010683817569,113.9543587765253,109.15910992089735
118.84698966435758,113.86794744733447,109.03065352633098
119.18085830401883,114.12830831094557,109.25699419733856
119.81567295627272,114.75684761770661,109.89580906685411
120.76326521267524,115.742083334167,110.90944997004836
122.03354824467185,117.04067079892921,112.20463572045877
123.49186499228664,118.58127457216008,113.77854615433921
125.15541127136517,120.2709406179764,115.44316740240318
126.89365061452054,122.00339961162967,117.12777224548434
128.6218453824203,123.66855966178939,118.70771114897195
130.13799798652042,125.16234049131411,120.17901541980844
131.34234704048916,126.39597061843133,121.46331658347619
132.17765388899457,127.30391704882051,122.48228740200413
132.7172572879352,127.84973914282192,123.08320478902942
133.0219100353167,128.0293437492481,123.186349583904
132.93455091218237,127.87135083438908,122.98973058574394
132.4939509772264,127.43453694566097,122.56345976084957
131.7887631702729,126.80258487767678,121.98496441162513
131.0247690118917,126.07660853743191,121.25860807195049
130.27164555235746,125.36612074013492,120.54153378663992
129.71654667609008,124.7792507555816,119.87723904323487
129.3572609063708,124.41308544252024,119.47022304519386
129.28815104427278,124.34499676870873,119.38979732374698
129.59013620461823,124.62573040346784,119.66083649483392
130.21456383897035,125.27487275817427,120.3659767873086
131.15508993875173,126.27910139046546,121.47771946198786
132.48808298835723,127.59337505833837,122.8220665703464
134.1585043208085,129.14495712015346,124.29662222632264
135.91624586992114,130.83991288220435,125.9496633545152
137.633736076585,132.57150050514548,127.68916465275844
139.20567865090607,134.2297059345968,129.4023242200996
140.5859255352183,135.71107012897224,130.93779292244716
141.81250366072146,136.92793074753726,132.09525917422252
142.754364932275,137.81625276622648,132.88840979194248
143.28785588129955,138.34134853563094,133.37899646988078
143.41286127577334,138.50097632541122,133.56914778640777
143.2542302257144,138.3255405713923,133.39865072137914
142.78440791301847,137.87537593786334,133.0076223601965
142.13787741350674,137.23535780170852,132.42316873592566
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 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 112.00454229927934 107.082865308575 102.1633636879963
16 111.903996698001 106.96031118542241 102.03702207594756
17 111.48149095236647 106.55098952518925 101.67783115273905
18 110.84753008292738 105.93612732359576 101.12981477034926
19 110.1823135395352 105.21531190077062 100.40326913125591
20 109.5036401798982 104.49759506253974 99.68310613110404
21 108.96140873233165 103.89175182739567 99.03055716743253
22 108.55757771159065 103.49656387805487 98.63355958617213
23 108.37119784452737 103.39199568793734 98.57524233498944
24 108.48123056464149 103.63205153291037 98.8947106702469
25 109.13355090120591 104.23995145016349 99.41036676194948
26 110.16562981720305 105.20605706144154 100.27299449048978
27 111.46754612622676 106.48873254066868 101.51564231169665
28 112.96480536016107 108.01806381828972 103.07772074367713
29 114.59091724799116 109.7021037968819 104.84319176799882
30 116.31238287778524 111.4350857115261 106.62930322893273
31 118.02171523469391 113.10687095991703 108.31262995838041
32 119.60041387832072 114.61278745568676 109.79025736162829
33 120.86843833251953 115.86297967414018 111.04856243742181
34 121.84199343121688 116.79043517866376 111.93416142447509
35 122.39011307800129 117.35697064210828 112.49710053406037
36 122.50576329657846 117.55664264968355 112.73761870284666
37 122.28492982985878 117.41627860650068 112.6261751502832
38 121.88410160023147 116.99308032537222 112.13535105079109
39 121.32841892406745 116.36951435923494 111.41502979189917
40 120.62769249435505 115.64594550958222 110.66031870509737
41 119.88266208381762 114.93167153765809 109.99034859761083
42 119.21334803236513 114.33515992096163 109.49959706481589
43 118.84010683817569 113.9543587765253 109.15910992089735
44 118.84698966435758 113.86794744733447 109.03065352633098
45 119.18085830401883 114.12830831094557 109.25699419733856
46 119.81567295627272 114.75684761770661 109.89580906685411
47 120.76326521267524 115.742083334167 110.90944997004836
48 122.03354824467185 117.04067079892921 112.20463572045877
49 123.49186499228664 118.58127457216008 113.77854615433921
50 125.15541127136517 120.2709406179764 115.44316740240318
51 126.89365061452054 122.00339961162967 117.12777224548434
52 128.6218453824203 123.66855966178939 118.70771114897195
53 130.13799798652042 125.16234049131411 120.17901541980844
54 131.34234704048916 126.39597061843133 121.46331658347619
55 132.17765388899457 127.30391704882051 122.48228740200413
56 132.7172572879352 127.84973914282192 123.08320478902942
57 133.0219100353167 128.0293437492481 123.186349583904
58 132.93455091218237 127.87135083438908 122.98973058574394
59 132.4939509772264 127.43453694566097 122.56345976084957
60 131.7887631702729 126.80258487767678 121.98496441162513
61 131.0247690118917 126.07660853743191 121.25860807195049
62 130.27164555235746 125.36612074013492 120.54153378663992
63 129.71654667609008 124.7792507555816 119.87723904323487
64 129.3572609063708 124.41308544252024 119.47022304519386
65 129.28815104427278 124.34499676870873 119.38979732374698
66 129.59013620461823 124.62573040346784 119.66083649483392
67 130.21456383897035 125.27487275817427 120.3659767873086
68 131.15508993875173 126.27910139046546 121.47771946198786
69 132.48808298835723 127.59337505833837 122.8220665703464
70 134.1585043208085 129.14495712015346 124.29662222632264
71 135.91624586992114 130.83991288220435 125.9496633545152
72 137.633736076585 132.57150050514548 127.68916465275844
73 139.20567865090607 134.2297059345968 129.4023242200996
74 140.5859255352183 135.71107012897224 130.93779292244716
75 141.81250366072146 136.92793074753726 132.09525917422252
76 142.754364932275 137.81625276622648 132.88840979194248
77 143.28785588129955 138.34134853563094 133.37899646988078
78 143.41286127577334 138.50097632541122 133.56914778640777
79 143.2542302257144 138.3255405713923 133.39865072137914
80 142.78440791301847 137.87537593786334 133.0076223601965
81 142.13787741350674 137.23535780170852 132.42316873592566