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
113.8045003699604,104.54687745272422,95.28925453548804
109.58834446131766,100.80265640568064,92.01696835004361
105.73137258544978,97.95811486967872,90.18485715390767
102.43807993053402,96.31009197555684,90.18210402057967
101.15293363552601,96.3952831412468,91.63763264696757
103.20029690993537,97.08205154990796,90.96380618988056
106.32510161131832,98.74923025127755,91.17335889123679
109.54022022493461,101.02448272711607,92.5087452292975
112.56654934841096,103.82953633151823,95.0925233146255
115.69836508697227,107.32489981199782,98.95143453702337
120.40202707582095,111.99972940585766,103.59743173589438
124.66452783954973,116.58165386569567,108.49877989184161
127.79864914989635,120.48080911490588,113.16296907991541
129.4082417178064,123.46432309831053,117.52040447881465
129.7321146392649,125.43747666771824,121.1428386961716
130.57271332152703,125.82049168708397,121.06827005264091
132.00479581067057,125.81905245428723,119.63330909790388
132.44635454156398,125.07460578735676,117.70285703314954
131.71237924833557,123.65669857887116,115.60101790940676
129.59995897658118,121.32895666139532,113.05795434620948
126.7942948778254,118.51062148599158,110.22694809415778
123.08057899058991,114.92727840165531,106.77397781272073
119.37075752643509,111.86638264101096,104.36200775558683
115.63939236114135,108.98925399752484,102.33911563390834
112.57506336658413,106.84996120992213,101.12485905326011
111.30403713029216,106.35987020388689,101.4157032774816
113.29382811110736,107.59131674208338,101.8888053730594
115.76972371414958,108.77734215728796,101.78496060042634
119.15370942824079,111.13987970628673,103.12604998433268
123.33523703654073,114.37459844066903,105.41395984479733
127.14038418498515,117.86746021378345,108.59453624258174
131.5239583211111,122.26317820342675,113.00239808574239
136.0418427539746,126.96508114762591,117.8883195412772
139.54120274047224,131.26176870344332,122.98233466641439
141.31237627643532,134.5201103503305,127.7278444242257
141.44709173259244,136.41767450915506,131.38825728571766
142.0922473683251,136.5579825097101,131.0237176510951
143.2705650373237,136.28407464614168,129.29758425495962
143.4139698734944,135.24661357840995,127.07925728332546
142.47851793380696,133.71373751111793,124.94895708842891
140.01626463401234,131.56179454412907,123.1073244542458
136.65826259411963,128.25247826806745,119.84669394201525
132.88933008603223,124.58160079508266,116.27387150413311
129.0447671163465,121.3277727085923,113.6107783008381
125.47030957663841,118.90216657381366,112.3340235709889
122.60248519855102,117.60953078085618,112.61657636316134
121.93415307848436,117.78458242044341,113.63501176240247
123.94838830624106,118.35727489887847,112.76616149151589
126.75625008370868,119.79442519617082,112.83260030863296
129.80523536741393,121.97773992340092,114.15024447938791
133.06294250948164,124.86211825912076,116.66129400875988
136.79793765689536,128.50670541931237,120.21547318172941
141.17735680745923,132.89133533022786,124.60531385299647
145.02476283911022,137.18252717157645,129.34029150404268
148.1117317596141,141.13112843775878,134.15052511590346
150.805952192229,144.71254863479115,138.6191450773533
152.194876753372,147.1659401531304,142.13700355288884
152.02936260629815,146.9595213326395,141.88968005898082
153.56768879576896,147.08700157070228,140.60631434563564
153.87654383128736,146.31099631700698,138.7454488027266
153.02808320320702,144.35231782569429,135.67655244818158
151.1720742912439,141.91681251734514,132.66155074344638
148.23551607612958,139.03157686851836,129.82763766090716
144.5576763198128,135.31599694385065,126.07431756788849
140.28885608701628,131.64610859509116,123.00336110316601
136.5053385771158,128.98395371754629,121.46256885797676
133.41315696537814,127.58448579848505,121.75581463159196
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 113.8045003699604 104.54687745272422 95.28925453548804
16 109.58834446131766 100.80265640568064 92.01696835004361
17 105.73137258544978 97.95811486967872 90.18485715390767
18 102.43807993053402 96.31009197555684 90.18210402057967
19 101.15293363552601 96.3952831412468 91.63763264696757
20 103.20029690993537 97.08205154990796 90.96380618988056
21 106.32510161131832 98.74923025127755 91.17335889123679
22 109.54022022493461 101.02448272711607 92.5087452292975
23 112.56654934841096 103.82953633151823 95.0925233146255
24 115.69836508697227 107.32489981199782 98.95143453702337
25 120.40202707582095 111.99972940585766 103.59743173589438
26 124.66452783954973 116.58165386569567 108.49877989184161
27 127.79864914989635 120.48080911490588 113.16296907991541
28 129.4082417178064 123.46432309831053 117.52040447881465
29 129.7321146392649 125.43747666771824 121.1428386961716
30 130.57271332152703 125.82049168708397 121.06827005264091
31 132.00479581067057 125.81905245428723 119.63330909790388
32 132.44635454156398 125.07460578735676 117.70285703314954
33 131.71237924833557 123.65669857887116 115.60101790940676
34 129.59995897658118 121.32895666139532 113.05795434620948
35 126.7942948778254 118.51062148599158 110.22694809415778
36 123.08057899058991 114.92727840165531 106.77397781272073
37 119.37075752643509 111.86638264101096 104.36200775558683
38 115.63939236114135 108.98925399752484 102.33911563390834
39 112.57506336658413 106.84996120992213 101.12485905326011
40 111.30403713029216 106.35987020388689 101.4157032774816
41 113.29382811110736 107.59131674208338 101.8888053730594
42 115.76972371414958 108.77734215728796 101.78496060042634
43 119.15370942824079 111.13987970628673 103.12604998433268
44 123.33523703654073 114.37459844066903 105.41395984479733
45 127.14038418498515 117.86746021378345 108.59453624258174
46 131.5239583211111 122.26317820342675 113.00239808574239
47 136.0418427539746 126.96508114762591 117.8883195412772
48 139.54120274047224 131.26176870344332 122.98233466641439
49 141.31237627643532 134.5201103503305 127.7278444242257
50 141.44709173259244 136.41767450915506 131.38825728571766
51 142.0922473683251 136.5579825097101 131.0237176510951
52 143.2705650373237 136.28407464614168 129.29758425495962
53 143.4139698734944 135.24661357840995 127.07925728332546
54 142.47851793380696 133.71373751111793 124.94895708842891
55 140.01626463401234 131.56179454412907 123.1073244542458
56 136.65826259411963 128.25247826806745 119.84669394201525
57 132.88933008603223 124.58160079508266 116.27387150413311
58 129.0447671163465 121.3277727085923 113.6107783008381
59 125.47030957663841 118.90216657381366 112.3340235709889
60 122.60248519855102 117.60953078085618 112.61657636316134
61 121.93415307848436 117.78458242044341 113.63501176240247
62 123.94838830624106 118.35727489887847 112.76616149151589
63 126.75625008370868 119.79442519617082 112.83260030863296
64 129.80523536741393 121.97773992340092 114.15024447938791
65 133.06294250948164 124.86211825912076 116.66129400875988
66 136.79793765689536 128.50670541931237 120.21547318172941
67 141.17735680745923 132.89133533022786 124.60531385299647
68 145.02476283911022 137.18252717157645 129.34029150404268
69 148.1117317596141 141.13112843775878 134.15052511590346
70 150.805952192229 144.71254863479115 138.6191450773533
71 152.194876753372 147.1659401531304 142.13700355288884
72 152.02936260629815 146.9595213326395 141.88968005898082
73 153.56768879576896 147.08700157070228 140.60631434563564
74 153.87654383128736 146.31099631700698 138.7454488027266
75 153.02808320320702 144.35231782569429 135.67655244818158
76 151.1720742912439 141.91681251734514 132.66155074344638
77 148.23551607612958 139.03157686851836 129.82763766090716
78 144.5576763198128 135.31599694385065 126.07431756788849
79 140.28885608701628 131.64610859509116 123.00336110316601
80 136.5053385771158 128.98395371754629 121.46256885797676
81 133.41315696537814 127.58448579848505 121.75581463159196