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 @@
pp,r1,s1
99.25,100.5,97.5
102.6858835747635,104.11625648842282,100.59445623929474
106.00309236476774,107.39278716644749,103.86703513059089
108.93999932460987,110.04907143793704,107.11512486962047
111.82033779671532,113.48777880883634,110.73664382213329
113.16936957727522,115.0391809023547,111.88725405911815
113.59241952863388,115.88215063469261,112.02058236567856
112.97312858671218,115.30538981324779,111.38648051333264
111.41036194567735,113.38172540477936,110.09681514604341
109.13129843961424,110.49720502713235,108.26959532721722
105.93724566302721,107.07544673027837,104.13479794609636
103.19468714218725,104.66958511703675,100.97274710886849
100.73788556021526,102.28844529407355,98.4736760993349
98.84415730000258,100.20211299874761,96.90642701067021
97.61148125753598,98.87586205817712,95.75548067458189
97.19141919443507,98.44462276334197,95.21829168553528
98.48350114468982,100.41823724231372,97.29355947935377
99.8701262670947,101.80746791358526,98.5873188986634
101.98212313628511,103.70870267174067,100.76394936263485
104.8254268723964,106.99249405186748,103.3257521334745
107.99920670201082,110.28787206385834,106.45819317908703
111.26162582273436,113.2779860561967,109.95670229705776
113.82531099154654,114.69119322432022,112.38364916958646
116.74498633735749,117.879915498178,115.01453932224099
119.1538057799276,120.6585703968869,116.92714940457292
121.00914737747458,122.62390626911443,118.65048198446769
122.20610596022017,123.63664165934762,120.12436205549115
122.64513494082007,123.71150378040258,121.06616042928587
122.14237501927037,123.21647998589984,120.39777914762388
121.68125023494567,123.72919137198745,120.38150069936285
119.85561076366399,122.00836449417844,118.41202094278356
117.51965254789604,119.43828718638532,116.17278107223869
115.03525638832207,117.01255843043465,113.65734326698984
112.63773801197561,114.79842864561428,111.20084422029188
110.51030959880836,112.50526529642408,109.25830351262861
108.26940272744443,109.35088178274958,106.540084289673
107.60207833614736,108.70743971746646,105.97991493669689
107.74794108755447,109.22801528502319,105.5943257230227
108.93803183752519,110.55537593682273,106.57202654475822
111.12884068832828,112.58699613595853,108.9638532655492
114.14636656555048,115.20199726707263,112.52300941695138
118.20907981363631,119.75694131555092,117.26445019903183
121.97291442834978,124.06087568859328,120.61059182015883
125.58660227166432,127.88230821801861,124.03282035834349
128.74292994082526,130.85398225680115,127.2763063859608
131.23499339252444,132.97412974737856,130.01685065159327
133.04164438675528,134.99941680765968,131.76041433014595
133.89857677557075,135.80218062803974,132.74403340529048
133.0922674800085,134.36101932912442,131.119074067261
132.27242827286773,133.52113889464036,130.4600470678841
130.70375416195242,132.10992406894522,128.6905385875856
128.637039841295,130.19482239926455,126.35184061536711
126.38366183377089,127.81836657911286,124.20812703231047
124.16985797315824,125.23239149207069,122.46634714843323
122.68443917750632,124.14345676749355,121.75060086176721
121.07933688479505,123.13551448966716,119.70265292811585
119.98032727470522,122.33510359467938,118.37494030945801
119.49766926250228,121.73997527765448,117.95735659826684
119.72723331910679,121.50025387879435,118.51380947735645
120.84874969892996,122.54498226119694,119.76334631937557
122.04843661384999,123.21925791926213,120.14848492145892
124.6025521206855,126.01658209372069,122.44885415766232
127.75414920753644,129.16774937502385,125.70306304765896
131.24131401643615,132.53358469377488,129.41968552339065
134.67484051577156,136.11554347254713,132.55174337464777
137.946708918021,139.30504641529893,135.83872370264007
141.4931197632729,143.24847820983604,140.43724934589036
143.5145158999682,145.14879826955396,142.43573953343068
144.7295048206305,146.69024336708017,143.38334763780378
144.97609002104508,147.30221144626717,143.3807479204221
144.18762156950126,146.4855630800217,142.6281182221707
142.48509527224925,144.36387619886287,141.24027015356899
140.1432507898188,141.54105277691102,139.278976859638
136.88600988144026,138.09546731469894,134.9913092954812
134.16901101832457,135.67647129320275,131.91171524417607
131.78967040161683,133.32518118214094,129.5572333143467
130.0118158199836,131.31645203465825,128.15578001020836
128.89094109224055,130.1664274710646,126.99715356415516
128.63134144530386,129.86320743341284,126.6671124425755
130.07774871998475,132.03463449580025,128.85800386759882
1 pp r1 s1
2 99.25 100.5 97.5
3 102.6858835747635 104.11625648842282 100.59445623929474
4 106.00309236476774 107.39278716644749 103.86703513059089
5 108.93999932460987 110.04907143793704 107.11512486962047
6 111.82033779671532 113.48777880883634 110.73664382213329
7 113.16936957727522 115.0391809023547 111.88725405911815
8 113.59241952863388 115.88215063469261 112.02058236567856
9 112.97312858671218 115.30538981324779 111.38648051333264
10 111.41036194567735 113.38172540477936 110.09681514604341
11 109.13129843961424 110.49720502713235 108.26959532721722
12 105.93724566302721 107.07544673027837 104.13479794609636
13 103.19468714218725 104.66958511703675 100.97274710886849
14 100.73788556021526 102.28844529407355 98.4736760993349
15 98.84415730000258 100.20211299874761 96.90642701067021
16 97.61148125753598 98.87586205817712 95.75548067458189
17 97.19141919443507 98.44462276334197 95.21829168553528
18 98.48350114468982 100.41823724231372 97.29355947935377
19 99.8701262670947 101.80746791358526 98.5873188986634
20 101.98212313628511 103.70870267174067 100.76394936263485
21 104.8254268723964 106.99249405186748 103.3257521334745
22 107.99920670201082 110.28787206385834 106.45819317908703
23 111.26162582273436 113.2779860561967 109.95670229705776
24 113.82531099154654 114.69119322432022 112.38364916958646
25 116.74498633735749 117.879915498178 115.01453932224099
26 119.1538057799276 120.6585703968869 116.92714940457292
27 121.00914737747458 122.62390626911443 118.65048198446769
28 122.20610596022017 123.63664165934762 120.12436205549115
29 122.64513494082007 123.71150378040258 121.06616042928587
30 122.14237501927037 123.21647998589984 120.39777914762388
31 121.68125023494567 123.72919137198745 120.38150069936285
32 119.85561076366399 122.00836449417844 118.41202094278356
33 117.51965254789604 119.43828718638532 116.17278107223869
34 115.03525638832207 117.01255843043465 113.65734326698984
35 112.63773801197561 114.79842864561428 111.20084422029188
36 110.51030959880836 112.50526529642408 109.25830351262861
37 108.26940272744443 109.35088178274958 106.540084289673
38 107.60207833614736 108.70743971746646 105.97991493669689
39 107.74794108755447 109.22801528502319 105.5943257230227
40 108.93803183752519 110.55537593682273 106.57202654475822
41 111.12884068832828 112.58699613595853 108.9638532655492
42 114.14636656555048 115.20199726707263 112.52300941695138
43 118.20907981363631 119.75694131555092 117.26445019903183
44 121.97291442834978 124.06087568859328 120.61059182015883
45 125.58660227166432 127.88230821801861 124.03282035834349
46 128.74292994082526 130.85398225680115 127.2763063859608
47 131.23499339252444 132.97412974737856 130.01685065159327
48 133.04164438675528 134.99941680765968 131.76041433014595
49 133.89857677557075 135.80218062803974 132.74403340529048
50 133.0922674800085 134.36101932912442 131.119074067261
51 132.27242827286773 133.52113889464036 130.4600470678841
52 130.70375416195242 132.10992406894522 128.6905385875856
53 128.637039841295 130.19482239926455 126.35184061536711
54 126.38366183377089 127.81836657911286 124.20812703231047
55 124.16985797315824 125.23239149207069 122.46634714843323
56 122.68443917750632 124.14345676749355 121.75060086176721
57 121.07933688479505 123.13551448966716 119.70265292811585
58 119.98032727470522 122.33510359467938 118.37494030945801
59 119.49766926250228 121.73997527765448 117.95735659826684
60 119.72723331910679 121.50025387879435 118.51380947735645
61 120.84874969892996 122.54498226119694 119.76334631937557
62 122.04843661384999 123.21925791926213 120.14848492145892
63 124.6025521206855 126.01658209372069 122.44885415766232
64 127.75414920753644 129.16774937502385 125.70306304765896
65 131.24131401643615 132.53358469377488 129.41968552339065
66 134.67484051577156 136.11554347254713 132.55174337464777
67 137.946708918021 139.30504641529893 135.83872370264007
68 141.4931197632729 143.24847820983604 140.43724934589036
69 143.5145158999682 145.14879826955396 142.43573953343068
70 144.7295048206305 146.69024336708017 143.38334763780378
71 144.97609002104508 147.30221144626717 143.3807479204221
72 144.18762156950126 146.4855630800217 142.6281182221707
73 142.48509527224925 144.36387619886287 141.24027015356899
74 140.1432507898188 141.54105277691102 139.278976859638
75 136.88600988144026 138.09546731469894 134.9913092954812
76 134.16901101832457 135.67647129320275 131.91171524417607
77 131.78967040161683 133.32518118214094 129.5572333143467
78 130.0118158199836 131.31645203465825 128.15578001020836
79 128.89094109224055 130.1664274710646 126.99715356415516
80 128.63134144530386 129.86320743341284 126.6671124425755
81 130.07774871998475 132.03463449580025 128.85800386759882