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
99.66666666666667,99.66666666666667,99.66666666666667,0
104.92770232875756,101.43186355934736,97.93602478993716,1.7479193847050967
108.69244982933654,103.1418467346444,97.59124363995227,2.7753015473460683
111.93189932087317,104.72524251435041,97.51858570782765,3.6033284032613793
114.53906435593598,106.11658814601071,97.69411193608545,4.21123810496263
116.41520043515631,107.26197807148026,98.1087557078042,4.5766111818380235
117.52564075193412,108.12392454778578,98.72220834363743,4.7008581020741715
117.92333610215195,108.68473286603445,99.44612962991695,4.619301618058748
117.7606807047838,108.94788218474959,100.13508366471538,4.406399260017102
117.28431319186235,108.93719496319889,100.59007673453543,4.17355911433173
116.78832468727425,108.6939142335673,100.59950377986034,4.04720522685348
116.50241704987188,108.27212140087826,100.04182575188464,4.115147824496811
116.47968589146114,107.73315655203712,98.98662721261309,4.373264669712011
116.61270359672542,107.13980697732005,97.66691035791467,4.736448309702689
116.74883579075927,106.55099511684338,96.35315444292749,5.098920336957942
116.7755008556913,106.01754191953432,95.25958298337734,5.378979468078491
116.64416907064926,105.574488719377,94.50480836810475,5.534840175636129
116.36170781621121,105.24403046718167,94.12635311815214,5.558838674514767
115.99977207847752,105.0532260289652,94.10667997945288,5.473273024756159
115.68962498757833,105.01668973808685,94.34375448859538,5.3364676247457385
115.60136018812608,105.13625480053574,94.6711494129454,5.232552693795174
115.89796439968907,105.40178194132667,94.90559948296428,5.248091229181201
116.66684724726818,105.79291824018027,94.91898923309236,5.436964503543958
117.87174831705467,106.281534783261,94.69132124946732,5.795106766896837
119.37005490301797,106.83455123904943,94.29904757508089,6.267751831984268
120.97540508158576,107.41687731587024,93.85834955015471,6.779263882857761
122.5133395512596,107.99424420127528,93.47514885129095,7.259547674992161
123.85005787017792,108.53574454861608,93.22143122705424,7.657156660780923
124.90191302624947,109.01593726593835,93.12996150562722,7.942987880155563
125.63536429903525,109.41640368389328,93.19744306875131,8.109480307570985
126.0616675636371,109.72667224007039,93.39167691650367,8.167497661783358
126.2271921251002,109.94446831076806,93.66174449643592,8.14136190716607
126.19889917929945,110.07829451614217,93.95768985298488,8.06030233157864
126.0412823154776,110.13781541771121,94.23434851994482,7.951733448883194
125.81343590191375,110.13654676966519,94.45965763741663,7.838444566124284
125.558861473763,110.09446794810344,94.63007442244388,7.7321967628297825
125.3020667117573,110.03604107972293,94.77001544768856,7.633012816017189
125.0571065920818,109.98753674805292,94.91796690402404,7.534784922014441
124.84365683556264,109.97402298898915,95.10438914241566,7.434816923286749
124.70178127081248,110.01646326126956,95.33114525172665,7.3426590047714555
124.69641213938546,110.12936768851321,95.56232323764097,7.283522225436122
124.90575483614657,110.3193480654346,95.73294129472262,7.293203385355985
125.39453074355737,110.58476263894983,95.77499453434228,7.404884052303775
126.18348301062304,110.91644060152191,95.64939819242079,7.63352120455056
127.23354419335064,111.29929375327781,95.36504331320498,7.967125220036418
128.455091588283,111.71449283739537,94.97389408650774,8.370299375443816
129.7348038323493,112.14183166129912,94.54885949024896,8.79648608552508
130.96398317883165,112.56192604713692,94.1598689154422,9.201028565847361
132.09477571231508,112.97175975899731,93.84874380567953,9.561507976658891
133.06323373058777,113.35701680111218,93.6507998716366,9.853108464737796
133.82942039783396,113.70418291569361,93.57894543355326,10.062618741070176
134.38352146473898,114.0038205912578,93.62411971777665,10.18985043674058
134.74082675986074,114.25128187847953,93.76173699709831,10.24477244069061
134.93379842260288,114.44692254399716,93.96004666539145,10.243437939302854
135.00316845719337,114.59582753713786,94.18848661708236,10.203670460027753
134.99008842670028,114.7071101701647,94.42413191362911,10.14148912826779
134.93110315501633,114.79288203685903,94.65466091870172,10.06911055907865
134.85691559183536,114.86700832886702,94.87710106589867,9.994953631484172
134.79463700029171,114.94376872046713,95.09290044064255,9.925434139912287
134.77190241713149,115.03654251078153,95.30118260443157,9.867679953174976
134.8203954251308,115.15663068517345,95.4928659452161,9.831882369978679
134.9763078430269,115.3123159645159,95.6483240860049,9.831995939255497
135.27619921325294,115.50824177852617,95.7402843437994,9.883978717363386
135.75170333853148,115.74673529012439,95.7417672417173,10.002484024203548
136.4371061280408,116.03442015889951,95.63173418975822,10.201342984570644
137.3286863495318,116.36702355054167,95.40536075155154,10.480831399495068
138.38920728865028,116.73595465861783,95.08270202858537,10.826626315016224
139.5521895388458,117.12895426065779,94.70571898246979,11.211617639094003
140.73468751689697,117.53127179630778,94.3278560757186,11.60170786029459
141.85373372480754,117.92724246665307,94.00075120849858,11.96324562907724
142.84120096441214,118.30204758751894,93.76289421062575,12.269576688446602
143.65355833782405,118.64339224639716,93.63322615497027,12.505083045713441
144.27516381041042,118.94283972962145,93.61051564883248,12.666162040394488
144.7155226374701,119.19660258528434,93.6776825330986,12.759460026092867
145.0022544018757,119.4056914713997,93.80912854092372,12.798281465237988
145.17232962143495,119.57544065225956,93.97855168308416,12.798444484587694
145.26426650943495,119.71453548143946,94.16480445344395,12.774865513997753
145.3132545167523,119.83373933276083,94.35422414876935,12.73975759199574
145.34977527237984,119.94454255354819,94.53930983471652,12.702616359415833
145.40173428451556,120.060012943307,94.71829160209845,12.670860670604275
1 upper middle lower stddev
2 99.66666666666667 99.66666666666667 99.66666666666667 0
3 104.92770232875756 101.43186355934736 97.93602478993716 1.7479193847050967
4 108.69244982933654 103.1418467346444 97.59124363995227 2.7753015473460683
5 111.93189932087317 104.72524251435041 97.51858570782765 3.6033284032613793
6 114.53906435593598 106.11658814601071 97.69411193608545 4.21123810496263
7 116.41520043515631 107.26197807148026 98.1087557078042 4.5766111818380235
8 117.52564075193412 108.12392454778578 98.72220834363743 4.7008581020741715
9 117.92333610215195 108.68473286603445 99.44612962991695 4.619301618058748
10 117.7606807047838 108.94788218474959 100.13508366471538 4.406399260017102
11 117.28431319186235 108.93719496319889 100.59007673453543 4.17355911433173
12 116.78832468727425 108.6939142335673 100.59950377986034 4.04720522685348
13 116.50241704987188 108.27212140087826 100.04182575188464 4.115147824496811
14 116.47968589146114 107.73315655203712 98.98662721261309 4.373264669712011
15 116.61270359672542 107.13980697732005 97.66691035791467 4.736448309702689
16 116.74883579075927 106.55099511684338 96.35315444292749 5.098920336957942
17 116.7755008556913 106.01754191953432 95.25958298337734 5.378979468078491
18 116.64416907064926 105.574488719377 94.50480836810475 5.534840175636129
19 116.36170781621121 105.24403046718167 94.12635311815214 5.558838674514767
20 115.99977207847752 105.0532260289652 94.10667997945288 5.473273024756159
21 115.68962498757833 105.01668973808685 94.34375448859538 5.3364676247457385
22 115.60136018812608 105.13625480053574 94.6711494129454 5.232552693795174
23 115.89796439968907 105.40178194132667 94.90559948296428 5.248091229181201
24 116.66684724726818 105.79291824018027 94.91898923309236 5.436964503543958
25 117.87174831705467 106.281534783261 94.69132124946732 5.795106766896837
26 119.37005490301797 106.83455123904943 94.29904757508089 6.267751831984268
27 120.97540508158576 107.41687731587024 93.85834955015471 6.779263882857761
28 122.5133395512596 107.99424420127528 93.47514885129095 7.259547674992161
29 123.85005787017792 108.53574454861608 93.22143122705424 7.657156660780923
30 124.90191302624947 109.01593726593835 93.12996150562722 7.942987880155563
31 125.63536429903525 109.41640368389328 93.19744306875131 8.109480307570985
32 126.0616675636371 109.72667224007039 93.39167691650367 8.167497661783358
33 126.2271921251002 109.94446831076806 93.66174449643592 8.14136190716607
34 126.19889917929945 110.07829451614217 93.95768985298488 8.06030233157864
35 126.0412823154776 110.13781541771121 94.23434851994482 7.951733448883194
36 125.81343590191375 110.13654676966519 94.45965763741663 7.838444566124284
37 125.558861473763 110.09446794810344 94.63007442244388 7.7321967628297825
38 125.3020667117573 110.03604107972293 94.77001544768856 7.633012816017189
39 125.0571065920818 109.98753674805292 94.91796690402404 7.534784922014441
40 124.84365683556264 109.97402298898915 95.10438914241566 7.434816923286749
41 124.70178127081248 110.01646326126956 95.33114525172665 7.3426590047714555
42 124.69641213938546 110.12936768851321 95.56232323764097 7.283522225436122
43 124.90575483614657 110.3193480654346 95.73294129472262 7.293203385355985
44 125.39453074355737 110.58476263894983 95.77499453434228 7.404884052303775
45 126.18348301062304 110.91644060152191 95.64939819242079 7.63352120455056
46 127.23354419335064 111.29929375327781 95.36504331320498 7.967125220036418
47 128.455091588283 111.71449283739537 94.97389408650774 8.370299375443816
48 129.7348038323493 112.14183166129912 94.54885949024896 8.79648608552508
49 130.96398317883165 112.56192604713692 94.1598689154422 9.201028565847361
50 132.09477571231508 112.97175975899731 93.84874380567953 9.561507976658891
51 133.06323373058777 113.35701680111218 93.6507998716366 9.853108464737796
52 133.82942039783396 113.70418291569361 93.57894543355326 10.062618741070176
53 134.38352146473898 114.0038205912578 93.62411971777665 10.18985043674058
54 134.74082675986074 114.25128187847953 93.76173699709831 10.24477244069061
55 134.93379842260288 114.44692254399716 93.96004666539145 10.243437939302854
56 135.00316845719337 114.59582753713786 94.18848661708236 10.203670460027753
57 134.99008842670028 114.7071101701647 94.42413191362911 10.14148912826779
58 134.93110315501633 114.79288203685903 94.65466091870172 10.06911055907865
59 134.85691559183536 114.86700832886702 94.87710106589867 9.994953631484172
60 134.79463700029171 114.94376872046713 95.09290044064255 9.925434139912287
61 134.77190241713149 115.03654251078153 95.30118260443157 9.867679953174976
62 134.8203954251308 115.15663068517345 95.4928659452161 9.831882369978679
63 134.9763078430269 115.3123159645159 95.6483240860049 9.831995939255497
64 135.27619921325294 115.50824177852617 95.7402843437994 9.883978717363386
65 135.75170333853148 115.74673529012439 95.7417672417173 10.002484024203548
66 136.4371061280408 116.03442015889951 95.63173418975822 10.201342984570644
67 137.3286863495318 116.36702355054167 95.40536075155154 10.480831399495068
68 138.38920728865028 116.73595465861783 95.08270202858537 10.826626315016224
69 139.5521895388458 117.12895426065779 94.70571898246979 11.211617639094003
70 140.73468751689697 117.53127179630778 94.3278560757186 11.60170786029459
71 141.85373372480754 117.92724246665307 94.00075120849858 11.96324562907724
72 142.84120096441214 118.30204758751894 93.76289421062575 12.269576688446602
73 143.65355833782405 118.64339224639716 93.63322615497027 12.505083045713441
74 144.27516381041042 118.94283972962145 93.61051564883248 12.666162040394488
75 144.7155226374701 119.19660258528434 93.6776825330986 12.759460026092867
76 145.0022544018757 119.4056914713997 93.80912854092372 12.798281465237988
77 145.17232962143495 119.57544065225956 93.97855168308416 12.798444484587694
78 145.26426650943495 119.71453548143946 94.16480445344395 12.774865513997753
79 145.3132545167523 119.83373933276083 94.35422414876935 12.73975759199574
80 145.34977527237984 119.94454255354819 94.53930983471652 12.702616359415833
81 145.40173428451556 120.060012943307 94.71829160209845 12.670860670604275