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
109.54456746495428,104.85872397420964,100.172880483465
111.65151860825563,107.6888216891277,103.72612476999979
112.89632833892851,109.9437586389845,106.9911889390405
113.21246502196237,111.4667715326924,109.72107804342244
112.8892248089026,112.16647767524587,111.44373054158915
113.0448085487968,112.02503791170568,111.00526727461457
113.11645015802397,111.09975014578013,109.0830501335363
112.40300630319841,109.51793108873431,106.63285587427022
110.89428341069745,107.465543436754,104.03680346281055
108.77045727553799,105.170584377139,101.57071147874
106.29055511139218,102.88271927859448,99.47488344579678
103.69537150274303,100.85097982741084,98.00658815207865
101.26138998311686,99.30151876860623,97.3416475540956
99.39183917325946,98.41740835475375,97.44297753624804
99.09696311889532,98.32228704689435,97.54761097489337
100.88606458106953,99.06931525903836,97.25256593700719
103.65175428251058,100.636426696707,97.62109911090343
106.93985035635006,102.92829947329929,98.91674859024852
110.50130048396242,105.7848709303295,101.06844137669658
114.06263444321557,108.99563555800292,103.92863667279026
117.36505788785524,112.3184488254675,107.27183976307975
120.15530188830373,115.5011572305877,110.84701257287166
122.21705705960778,118.30412242131366,114.39118778301955
123.41081646361405,120.52162737596674,117.63243828831943
123.67460863895239,122.00025249210896,120.32589634526552
123.32334238951928,122.65258010270678,121.98181781589427
123.52967694292381,122.46500323597539,121.40032952902696
123.57168767418082,121.49894108564327,119.42619449710571
122.81008363613644,119.88535261729821,116.96062159845998
121.26150106551827,117.81303839402005,114.36457572252183
119.11116121675727,115.5117755843763,111.91238995199532
116.61754881051904,113.23179265228805,109.84603649405706
114.02410909737821,111.22141719359121,108.4187252898042
111.60716983386915,109.70489357148244,107.80261730909574
109.79101890540441,108.86235183541076,107.93368476541711
109.64025166035313,108.81371724023293,107.98718282011274
111.49550123607261,109.60799768036453,107.72049412465645
114.29635096239225,111.21890596052967,108.14146095866708
117.60669067034175,113.54720795262513,109.48772523490851
121.1754810837076,116.42958688483967,111.68369268597174
124.7285962944926,119.65323194248148,114.57786759047036
128.00943849537012,122.97484802425063,117.94025755313115
130.76373058571465,126.14238856904419,121.52104655237372
132.77984823430293,128.9175701246016,125.05529201490029
133.92236116696577,131.09715749862715,128.27195383028854
134.13387561699338,132.5311181532323,130.92836068947125
133.75476039371082,133.1360241647106,132.51728793571036
134.01163192425003,132.9025045914931,131.7933772587362
134.02407764994823,131.89608255244985,129.76808745495148
133.21467011850407,130.25132224182528,127.28797436514648
131.62680705985076,128.15980871053245,124.69281036121414
129.45070282074064,125.8530341441435,122.25536546754638
126.94422654816275,123.58171935539417,120.2192121626256
124.35340533018136,121.5934176406918,118.83342995120223
121.95433302095667,120.11040158142316,118.26647014188966
120.19230042645569,119.30980809624275,118.4273157660298
120.18612284393471,119.30781532768759,118.42950781144047
122.1072009808641,120.14926479471215,118.1913286085602
124.94256021918531,121.80365583334944,118.66475144751357
128.27434900167492,124.16787013018447,120.06139125869402
131.8496120701715,127.07538297417945,122.30115387818739
135.39364533367225,130.31113841315837,125.22863149264451
138.65212007096625,133.6307595615242,128.60939905208215
141.36982290144138,136.78237805963352,132.19493321782565
143.33987437956597,139.52913272423623,135.7183910689065
144.4309591849817,141.67032765254316,138.90969612010463
144.59027747241987,143.05935978949947,141.52844210657906
144.18349821147515,143.61681454207186,143.05013087266857
144.49067859459367,143.3375596483277,142.18444070206172
144.47363354597658,142.2912036271084,140.1087737082402
143.61679272630107,140.6158778563527,137.61496298640435
141.9902394753585,138.50589770849567,135.02155594163284
139.78912745344638,136.1944049369688,132.5996824204912
137.27063732724702,133.93254181772085,130.59444630819468
134.6833084637562,131.967017357672,129.25072625158782
132.3029227555087,130.5180695138873,128.7332162722659
130.5957116468157,129.75979199279567,128.92387233877565
1 upper middle lower
2 nan nan nan
3 nan nan nan
4 nan nan nan
5 109.54456746495428 104.85872397420964 100.172880483465
6 111.65151860825563 107.6888216891277 103.72612476999979
7 112.89632833892851 109.9437586389845 106.9911889390405
8 113.21246502196237 111.4667715326924 109.72107804342244
9 112.8892248089026 112.16647767524587 111.44373054158915
10 113.0448085487968 112.02503791170568 111.00526727461457
11 113.11645015802397 111.09975014578013 109.0830501335363
12 112.40300630319841 109.51793108873431 106.63285587427022
13 110.89428341069745 107.465543436754 104.03680346281055
14 108.77045727553799 105.170584377139 101.57071147874
15 106.29055511139218 102.88271927859448 99.47488344579678
16 103.69537150274303 100.85097982741084 98.00658815207865
17 101.26138998311686 99.30151876860623 97.3416475540956
18 99.39183917325946 98.41740835475375 97.44297753624804
19 99.09696311889532 98.32228704689435 97.54761097489337
20 100.88606458106953 99.06931525903836 97.25256593700719
21 103.65175428251058 100.636426696707 97.62109911090343
22 106.93985035635006 102.92829947329929 98.91674859024852
23 110.50130048396242 105.7848709303295 101.06844137669658
24 114.06263444321557 108.99563555800292 103.92863667279026
25 117.36505788785524 112.3184488254675 107.27183976307975
26 120.15530188830373 115.5011572305877 110.84701257287166
27 122.21705705960778 118.30412242131366 114.39118778301955
28 123.41081646361405 120.52162737596674 117.63243828831943
29 123.67460863895239 122.00025249210896 120.32589634526552
30 123.32334238951928 122.65258010270678 121.98181781589427
31 123.52967694292381 122.46500323597539 121.40032952902696
32 123.57168767418082 121.49894108564327 119.42619449710571
33 122.81008363613644 119.88535261729821 116.96062159845998
34 121.26150106551827 117.81303839402005 114.36457572252183
35 119.11116121675727 115.5117755843763 111.91238995199532
36 116.61754881051904 113.23179265228805 109.84603649405706
37 114.02410909737821 111.22141719359121 108.4187252898042
38 111.60716983386915 109.70489357148244 107.80261730909574
39 109.79101890540441 108.86235183541076 107.93368476541711
40 109.64025166035313 108.81371724023293 107.98718282011274
41 111.49550123607261 109.60799768036453 107.72049412465645
42 114.29635096239225 111.21890596052967 108.14146095866708
43 117.60669067034175 113.54720795262513 109.48772523490851
44 121.1754810837076 116.42958688483967 111.68369268597174
45 124.7285962944926 119.65323194248148 114.57786759047036
46 128.00943849537012 122.97484802425063 117.94025755313115
47 130.76373058571465 126.14238856904419 121.52104655237372
48 132.77984823430293 128.9175701246016 125.05529201490029
49 133.92236116696577 131.09715749862715 128.27195383028854
50 134.13387561699338 132.5311181532323 130.92836068947125
51 133.75476039371082 133.1360241647106 132.51728793571036
52 134.01163192425003 132.9025045914931 131.7933772587362
53 134.02407764994823 131.89608255244985 129.76808745495148
54 133.21467011850407 130.25132224182528 127.28797436514648
55 131.62680705985076 128.15980871053245 124.69281036121414
56 129.45070282074064 125.8530341441435 122.25536546754638
57 126.94422654816275 123.58171935539417 120.2192121626256
58 124.35340533018136 121.5934176406918 118.83342995120223
59 121.95433302095667 120.11040158142316 118.26647014188966
60 120.19230042645569 119.30980809624275 118.4273157660298
61 120.18612284393471 119.30781532768759 118.42950781144047
62 122.1072009808641 120.14926479471215 118.1913286085602
63 124.94256021918531 121.80365583334944 118.66475144751357
64 128.27434900167492 124.16787013018447 120.06139125869402
65 131.8496120701715 127.07538297417945 122.30115387818739
66 135.39364533367225 130.31113841315837 125.22863149264451
67 138.65212007096625 133.6307595615242 128.60939905208215
68 141.36982290144138 136.78237805963352 132.19493321782565
69 143.33987437956597 139.52913272423623 135.7183910689065
70 144.4309591849817 141.67032765254316 138.90969612010463
71 144.59027747241987 143.05935978949947 141.52844210657906
72 144.18349821147515 143.61681454207186 143.05013087266857
73 144.49067859459367 143.3375596483277 142.18444070206172
74 144.47363354597658 142.2912036271084 140.1087737082402
75 143.61679272630107 140.6158778563527 137.61496298640435
76 141.9902394753585 138.50589770849567 135.02155594163284
77 139.78912745344638 136.1944049369688 132.5996824204912
78 137.27063732724702 133.93254181772085 130.59444630819468
79 134.6833084637562 131.967017357672 129.25072625158782
80 132.3029227555087 130.5180695138873 128.7332162722659
81 130.5957116468157 129.75979199279567 128.92387233877565