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_outer,upper_inner,middle,lower_inner,lower_outer
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,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,nan,nan
nan,nan,nan,nan,nan
nan,nan,nan,nan,nan
nan,nan,nan,nan,nan
115.28678132658357,110.08625971844405,104.88573811030453,99.685216502165,94.4846948940255
115.44235076607696,110.344190563641,105.24603036120507,100.14787015876914,95.04970995633319
116.031797084579,110.81923714634779,105.60667720811657,100.39411726988534,95.18155733165413
117.04307249142056,111.51159957229815,105.98012665317574,100.44865373405334,94.91718081493093
118.42198305380711,112.39983306718162,106.37768308055611,100.3555330939306,94.33338310730511
120.08275668667552,113.44562707808629,106.80849746949707,100.17136786090785,93.53423825231862
121.91875364904577,114.5987518068141,107.2787499645824,99.95874812235071,92.63874628011904
123.81164604805659,115.8013719349436,107.79109782183062,99.78082370871763,91.77054959560465
125.64023050374611,116.99233427383741,108.34443804392872,99.69654181402002,91.04864558411133
127.28963390911599,118.11181990840664,108.9340059076973,99.75619190698795,90.5783779062786
128.66054775091027,119.10617416676587,109.55180058262147,99.99742699847707,90.44305341433265
129.67757252249928,119.93243617185584,110.18729982121242,100.442163470569,90.69702711992556
130.29572502322122,120.56206245162939,110.82839988003757,101.09473730844574,91.36107473685391
130.50437915457422,120.98343793282388,111.4624967110735,101.94155548932312,92.42061426757276
130.32821912788876,121.20291548583329,112.07761184377782,102.95230820172235,93.82700455966688
129.8251239347045,121.24429316044616,112.66346238618785,104.08263161192953,95.5018008376712
129.08124974424334,121.14681465463894,113.21237956503455,105.27794447543016,97.34350938582577
128.2039061910054,120.96194997271232,113.71999375441924,106.47803753612615,99.23608131783307
127.3130646923414,120.74934474691126,114.18562480148111,107.62190485605096,101.05818491062082
126.53231715555998,120.57232996899336,114.61234278242675,108.65235559586014,102.69236840929352
125.97953405782138,120.49311390979372,115.00669376176606,109.5202736137384,104.03385346571073
125.75638565002856,120.56725035094694,115.37811505186531,110.18897975278368,104.99984445370205
125.9357870598765,120.83693963290837,115.73809220594023,110.6392447789721,105.54039735200396
126.54962545900983,121.32437925340197,116.09913304779411,110.87388684218625,105.64864063657839
127.5832865042029,122.02846844468587,116.47365038516884,110.9188323256518,105.36401426613477
128.98050368815137,122.92667844937462,116.87285321059787,110.81902797182111,104.76520273304435
130.6540678076189,123.9799066215526,117.3057454354863,110.63158424942,103.9574230633537
132.49645112780993,125.13738636266548,117.77832159752104,110.4192568323766,103.06019206723217
134.3889288726604,126.34098012956642,118.29303138647245,110.24508264337848,102.19713390028451
136.21040535734892,127.52948308902593,118.84856082070294,110.16763855237996,101.48671628405697
137.8466392967716,128.64329445900245,119.43994962123331,110.23660478346417,101.03325994569502
139.19945460276048,129.62924445072574,120.05903429869099,110.48882414665624,100.9186139946215
140.1950055547042,130.44509146410348,120.69517737350274,110.945263282902,101.19534919230128
140.79015691470516,131.06318725248457,121.33621759026396,111.60924792804336,101.88227826582275
140.97626533174446,131.47291078910447,121.96955624646452,112.46620170382455,102.9628471611846
140.77995945870256,131.6816210278823,122.58328259706207,113.48494416624182,104.38660573542157
140.2608570959882,131.71404745092576,123.16723780586335,114.62042816080093,106.07361851573852
139.5065053256598,131.6102138648828,123.71392240410584,115.81763094332887,107.9213394825519
138.62515648619677,131.4221613409319,124.21916619566703,117.01617105040216,109.8131759051373
137.7372262869952,131.2098635276296,124.68250076826405,118.15513800889848,111.62777524953292
136.96623775826222,131.0367195467951,125.10720133532797,119.17768312386085,113.24816491239372
136.42944797138296,130.96472107116267,125.49999417094236,120.03526727072206,114.57054037050175
136.22726554012488,131.04886065596838,125.87045577181189,120.6920508876554,115.51364600349889
136.43060069072433,131.33037905402867,126.230157417333,121.12993578063734,116.02971414394166
137.06878377954558,131.8302076606066,126.59163154166757,121.35305542272856,116.11447930378954
138.12465065906432,132.5459514538941,126.9672522487239,121.38855304355369,115.80985383838346
139.53989769930303,133.45401383480544,127.36812997030788,121.2822461058103,115.19636224131273
141.22591219022797,134.5145155972837,127.80311900433938,121.09172241139508,114.38032581845077
143.07430661728296,135.67616660203615,128.27802658678937,120.87988657154257,113.48174655629578
144.9659868609782,136.88054050478212,128.79509414858606,120.70964779238999,112.62420143619393
146.77999404813113,138.0663955716984,129.35279709526566,120.63919861883292,111.92560014240019
148.40274791188529,139.1743644531702,129.9459809944551,120.71759753574003,111.48921407702495
149.7372310064368,140.15177650620086,130.56632200596493,120.98086750572901,111.39541300549307
150.7111716289501,140.95712102729638,131.2030704256427,121.44901982398899,111.69496922233529
151.2832944894774,141.56365270695355,131.8440109244297,122.12436914190586,112.40472735938202
151.44694145156345,141.96174757944448,132.47655370732554,122.99135983520658,113.50616596308762
151.2306783629382,142.159768742609,133.08885912227984,124.01794950195067,114.94703988162149
150.69584577480683,142.18337051792764,133.67089526104846,125.15842000416927,116.64594474729007
149.93135875840417,142.0733464190418,134.21533407967942,126.35732174031705,118.49930940095467
149.04638529170163,141.882295641278,134.71820599085441,127.55411634043081,120.39002669000722
148.16175684928777,141.6705056522946,135.17925445530142,128.68800325830824,122.19675206131508
1 upper_outer upper_inner middle lower_inner lower_outer
2 nan nan nan nan nan
3 nan nan nan nan nan
4 nan nan nan nan nan
5 nan nan nan nan nan
6 nan nan nan nan nan
7 nan nan nan nan nan
8 nan nan nan nan nan
9 nan nan nan nan nan
10 nan nan nan nan nan
11 nan nan nan nan nan
12 nan nan nan nan nan
13 nan nan nan nan nan
14 nan nan nan nan nan
15 nan nan nan nan nan
16 nan nan nan nan nan
17 nan nan nan nan nan
18 nan nan nan nan nan
19 nan nan nan nan nan
20 nan nan nan nan nan
21 115.28678132658357 110.08625971844405 104.88573811030453 99.685216502165 94.4846948940255
22 115.44235076607696 110.344190563641 105.24603036120507 100.14787015876914 95.04970995633319
23 116.031797084579 110.81923714634779 105.60667720811657 100.39411726988534 95.18155733165413
24 117.04307249142056 111.51159957229815 105.98012665317574 100.44865373405334 94.91718081493093
25 118.42198305380711 112.39983306718162 106.37768308055611 100.3555330939306 94.33338310730511
26 120.08275668667552 113.44562707808629 106.80849746949707 100.17136786090785 93.53423825231862
27 121.91875364904577 114.5987518068141 107.2787499645824 99.95874812235071 92.63874628011904
28 123.81164604805659 115.8013719349436 107.79109782183062 99.78082370871763 91.77054959560465
29 125.64023050374611 116.99233427383741 108.34443804392872 99.69654181402002 91.04864558411133
30 127.28963390911599 118.11181990840664 108.9340059076973 99.75619190698795 90.5783779062786
31 128.66054775091027 119.10617416676587 109.55180058262147 99.99742699847707 90.44305341433265
32 129.67757252249928 119.93243617185584 110.18729982121242 100.442163470569 90.69702711992556
33 130.29572502322122 120.56206245162939 110.82839988003757 101.09473730844574 91.36107473685391
34 130.50437915457422 120.98343793282388 111.4624967110735 101.94155548932312 92.42061426757276
35 130.32821912788876 121.20291548583329 112.07761184377782 102.95230820172235 93.82700455966688
36 129.8251239347045 121.24429316044616 112.66346238618785 104.08263161192953 95.5018008376712
37 129.08124974424334 121.14681465463894 113.21237956503455 105.27794447543016 97.34350938582577
38 128.2039061910054 120.96194997271232 113.71999375441924 106.47803753612615 99.23608131783307
39 127.3130646923414 120.74934474691126 114.18562480148111 107.62190485605096 101.05818491062082
40 126.53231715555998 120.57232996899336 114.61234278242675 108.65235559586014 102.69236840929352
41 125.97953405782138 120.49311390979372 115.00669376176606 109.5202736137384 104.03385346571073
42 125.75638565002856 120.56725035094694 115.37811505186531 110.18897975278368 104.99984445370205
43 125.9357870598765 120.83693963290837 115.73809220594023 110.6392447789721 105.54039735200396
44 126.54962545900983 121.32437925340197 116.09913304779411 110.87388684218625 105.64864063657839
45 127.5832865042029 122.02846844468587 116.47365038516884 110.9188323256518 105.36401426613477
46 128.98050368815137 122.92667844937462 116.87285321059787 110.81902797182111 104.76520273304435
47 130.6540678076189 123.9799066215526 117.3057454354863 110.63158424942 103.9574230633537
48 132.49645112780993 125.13738636266548 117.77832159752104 110.4192568323766 103.06019206723217
49 134.3889288726604 126.34098012956642 118.29303138647245 110.24508264337848 102.19713390028451
50 136.21040535734892 127.52948308902593 118.84856082070294 110.16763855237996 101.48671628405697
51 137.8466392967716 128.64329445900245 119.43994962123331 110.23660478346417 101.03325994569502
52 139.19945460276048 129.62924445072574 120.05903429869099 110.48882414665624 100.9186139946215
53 140.1950055547042 130.44509146410348 120.69517737350274 110.945263282902 101.19534919230128
54 140.79015691470516 131.06318725248457 121.33621759026396 111.60924792804336 101.88227826582275
55 140.97626533174446 131.47291078910447 121.96955624646452 112.46620170382455 102.9628471611846
56 140.77995945870256 131.6816210278823 122.58328259706207 113.48494416624182 104.38660573542157
57 140.2608570959882 131.71404745092576 123.16723780586335 114.62042816080093 106.07361851573852
58 139.5065053256598 131.6102138648828 123.71392240410584 115.81763094332887 107.9213394825519
59 138.62515648619677 131.4221613409319 124.21916619566703 117.01617105040216 109.8131759051373
60 137.7372262869952 131.2098635276296 124.68250076826405 118.15513800889848 111.62777524953292
61 136.96623775826222 131.0367195467951 125.10720133532797 119.17768312386085 113.24816491239372
62 136.42944797138296 130.96472107116267 125.49999417094236 120.03526727072206 114.57054037050175
63 136.22726554012488 131.04886065596838 125.87045577181189 120.6920508876554 115.51364600349889
64 136.43060069072433 131.33037905402867 126.230157417333 121.12993578063734 116.02971414394166
65 137.06878377954558 131.8302076606066 126.59163154166757 121.35305542272856 116.11447930378954
66 138.12465065906432 132.5459514538941 126.9672522487239 121.38855304355369 115.80985383838346
67 139.53989769930303 133.45401383480544 127.36812997030788 121.2822461058103 115.19636224131273
68 141.22591219022797 134.5145155972837 127.80311900433938 121.09172241139508 114.38032581845077
69 143.07430661728296 135.67616660203615 128.27802658678937 120.87988657154257 113.48174655629578
70 144.9659868609782 136.88054050478212 128.79509414858606 120.70964779238999 112.62420143619393
71 146.77999404813113 138.0663955716984 129.35279709526566 120.63919861883292 111.92560014240019
72 148.40274791188529 139.1743644531702 129.9459809944551 120.71759753574003 111.48921407702495
73 149.7372310064368 140.15177650620086 130.56632200596493 120.98086750572901 111.39541300549307
74 150.7111716289501 140.95712102729638 131.2030704256427 121.44901982398899 111.69496922233529
75 151.2832944894774 141.56365270695355 131.8440109244297 122.12436914190586 112.40472735938202
76 151.44694145156345 141.96174757944448 132.47655370732554 122.99135983520658 113.50616596308762
77 151.2306783629382 142.159768742609 133.08885912227984 124.01794950195067 114.94703988162149
78 150.69584577480683 142.18337051792764 133.67089526104846 125.15842000416927 116.64594474729007
79 149.93135875840417 142.0733464190418 134.21533407967942 126.35732174031705 118.49930940095467
80 149.04638529170163 141.882295641278 134.71820599085441 127.55411634043081 120.39002669000722
81 148.16175684928777 141.6705056522946 135.17925445530142 128.68800325830824 122.19675206131508