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 @@
open,high,low,close
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
107.03252484838643,108.67272128360027,105.39232841317258,107.03252484838642
107.03252484838643,107.4453560245189,104.18629801900222,105.81582702176057
106.42417593507349,106.42417593507349,103.08655369987235,104.71390090745004
105.56903842126177,105.56903842126177,102.21484854616484,103.8335279769295
104.70128319909563,104.8789709047384,101.64390668942343,103.2614387970809
103.98136099808826,104.65514770543133,101.45879161094425,103.0569696581878
103.51916532813803,104.87780822621627,101.61873402187506,103.24827112404566
103.38371822609184,105.49946315937872,102.16430833098016,103.83188574517945
103.60780198563565,106.44174131791635,103.10843596541908,104.77508864166771
104.19144531365168,107.61843885066172,104.19144531365168,106.02017026093066
105.10580778729117,109.06603811757003,105.10580778729117,107.48984692807396
106.29782735768256,110.70796132259832,106.29782735768256,109.09316755888081
107.6954974582817,112.39594151564941,107.6954974582817,110.73155863478446
109.21352804653307,113.98152929555606,109.21352804653307,112.30491215854931
110.75922010254119,115.34720664979582,110.75922010254119,113.71778224098222
112.2385011717617,116.48584188194529,112.2385011717617,114.8857606717551
113.5621309217584,117.35186293375638,113.5621309217584,115.74194650674991
114.65203871425416,117.87817462052813,114.60814034019758,116.24315748036287
115.44759809730851,118.0099545409315,114.74052401609214,116.37523927851183
115.91141868791017,117.79704987009454,114.51618139344112,116.15661563176783
116.03401715983901,117.30072746123652,113.97763019142724,115.63917882633189
115.83659799308545,116.56227255773673,113.24932668606262,114.90579962189969
115.37119880749256,115.68713237206728,112.44113961753952,114.06413599480342
114.71766740114799,114.82541362053801,111.64854992917803,113.23698177485804
113.97732458800301,114.16889933141113,110.93112552396573,112.55001242768843
113.26366850784572,113.78691770459527,110.44973381920065,112.11832576189798
112.69099713487185,113.72117242546355,110.3458606754003,112.03351655043193
112.36225684265189,113.99431259728836,110.71184403388405,112.3530783155862
112.35766757911904,114.68223217474868,111.50509393759573,113.0936630561722
112.72566531764562,115.83596615632096,112.6224085016638,114.2291873289924
113.47742632331901,117.3432218934762,113.47742632331901,115.69404771914641
114.58573702123272,119.05873277377134,114.58573702123272,117.39093676462952
115.98833689293112,120.84465322172925,115.98833689293112,119.20207807408731
117.59520748350921,122.64174938461397,117.59520748350921,121.00225075815672
119.29872912083297,124.29659881944558,119.29872912083297,122.67182352833268
120.98527632458283,125.73244709588697,120.98527632458283,124.10817882613155
122.54672757535718,126.84609541348222,122.54672757535718,125.23432345791045
123.89052551663382,127.62887865652716,123.89052551663382,126.00405059627431
124.94728805645406,128.06799337795326,124.73922716899533,126.4036102734743
125.67544916496418,128.13348714559035,124.76719115825314,126.45033915192175
126.06289415844296,127.83213803256274,124.54587559771883,126.18900681514079
126.12595048679188,127.27028996065377,124.10314839635888,125.68671917850631
125.9063348326491,126.62838741142984,123.42581651416742,125.02710196279864
125.46671839772387,125.95603098856618,122.65244777290924,124.30423938073771
124.8854788892308,125.30029111365572,121.93283650283469,123.6165638082452
124.25102134873799,124.7190065866159,121.40235333704597,123.06067996183094
123.65585065528447,124.34769278553169,121.1023751769949,122.72503398126331
123.19044231827388,124.29445218829295,121.07240719452062,122.6834296914068
122.93693600484033,124.62269190768171,121.35455585493793,122.98862388130983
122.96277994307508,125.31369770231268,122.01935494628607,123.66652632429938
123.31465313368723,126.34693034326854,123.07664673199426,124.71178853763142
124.01322083565933,127.74039798508545,124.01322083565933,126.08568841367331
125.04945462466631,129.3823041381943,125.04945462466631,127.71713432879321
126.38329447672976,131.13786227718913,126.38329447672976,129.5072998514451
127.94529716408744,132.931919609098,127.94529716408744,131.3378949243783
129.64159604423287,134.68441859501257,129.64159604423287,133.08247081963708
131.36203343193498,136.26935373189997,131.36203343193498,134.6195680915182
132.99080076172658,137.53305655655757,132.99080076172658,135.84607934436997
134.41844005304827,138.35930506780716,134.41844005304827,136.68901774755832
135.5537289003033,138.71240102143284,135.51562621069843,137.11401361606562
136.33387125818444,138.72150894756172,135.53708304236287,137.1292959949623
136.73158362657335,138.41548199354992,135.15367873584066,136.78458036469527
136.7580819956343,137.82969872626154,134.50040952054093,136.16505412340123
136.4615680595178,137.03478578006118,133.72797886517665,135.38138232261892
135.92147519106834,136.20144482542983,132.91297564494198,134.5572102351859
135.23934271312712,135.4539949084435,132.1778422865757,133.81591859750958
134.52763065531835,134.89979473030047,131.63691170758818,133.2683532189443
1 open high low close
2 nan nan nan nan
3 nan nan nan nan
4 nan nan nan nan
5 nan nan nan nan
6 nan nan nan nan
7 nan nan nan nan
8 nan nan nan nan
9 nan nan nan nan
10 nan nan nan nan
11 nan nan nan nan
12 nan nan nan nan
13 nan nan nan nan
14 nan nan nan nan
15 107.03252484838643 108.67272128360027 105.39232841317258 107.03252484838642
16 107.03252484838643 107.4453560245189 104.18629801900222 105.81582702176057
17 106.42417593507349 106.42417593507349 103.08655369987235 104.71390090745004
18 105.56903842126177 105.56903842126177 102.21484854616484 103.8335279769295
19 104.70128319909563 104.8789709047384 101.64390668942343 103.2614387970809
20 103.98136099808826 104.65514770543133 101.45879161094425 103.0569696581878
21 103.51916532813803 104.87780822621627 101.61873402187506 103.24827112404566
22 103.38371822609184 105.49946315937872 102.16430833098016 103.83188574517945
23 103.60780198563565 106.44174131791635 103.10843596541908 104.77508864166771
24 104.19144531365168 107.61843885066172 104.19144531365168 106.02017026093066
25 105.10580778729117 109.06603811757003 105.10580778729117 107.48984692807396
26 106.29782735768256 110.70796132259832 106.29782735768256 109.09316755888081
27 107.6954974582817 112.39594151564941 107.6954974582817 110.73155863478446
28 109.21352804653307 113.98152929555606 109.21352804653307 112.30491215854931
29 110.75922010254119 115.34720664979582 110.75922010254119 113.71778224098222
30 112.2385011717617 116.48584188194529 112.2385011717617 114.8857606717551
31 113.5621309217584 117.35186293375638 113.5621309217584 115.74194650674991
32 114.65203871425416 117.87817462052813 114.60814034019758 116.24315748036287
33 115.44759809730851 118.0099545409315 114.74052401609214 116.37523927851183
34 115.91141868791017 117.79704987009454 114.51618139344112 116.15661563176783
35 116.03401715983901 117.30072746123652 113.97763019142724 115.63917882633189
36 115.83659799308545 116.56227255773673 113.24932668606262 114.90579962189969
37 115.37119880749256 115.68713237206728 112.44113961753952 114.06413599480342
38 114.71766740114799 114.82541362053801 111.64854992917803 113.23698177485804
39 113.97732458800301 114.16889933141113 110.93112552396573 112.55001242768843
40 113.26366850784572 113.78691770459527 110.44973381920065 112.11832576189798
41 112.69099713487185 113.72117242546355 110.3458606754003 112.03351655043193
42 112.36225684265189 113.99431259728836 110.71184403388405 112.3530783155862
43 112.35766757911904 114.68223217474868 111.50509393759573 113.0936630561722
44 112.72566531764562 115.83596615632096 112.6224085016638 114.2291873289924
45 113.47742632331901 117.3432218934762 113.47742632331901 115.69404771914641
46 114.58573702123272 119.05873277377134 114.58573702123272 117.39093676462952
47 115.98833689293112 120.84465322172925 115.98833689293112 119.20207807408731
48 117.59520748350921 122.64174938461397 117.59520748350921 121.00225075815672
49 119.29872912083297 124.29659881944558 119.29872912083297 122.67182352833268
50 120.98527632458283 125.73244709588697 120.98527632458283 124.10817882613155
51 122.54672757535718 126.84609541348222 122.54672757535718 125.23432345791045
52 123.89052551663382 127.62887865652716 123.89052551663382 126.00405059627431
53 124.94728805645406 128.06799337795326 124.73922716899533 126.4036102734743
54 125.67544916496418 128.13348714559035 124.76719115825314 126.45033915192175
55 126.06289415844296 127.83213803256274 124.54587559771883 126.18900681514079
56 126.12595048679188 127.27028996065377 124.10314839635888 125.68671917850631
57 125.9063348326491 126.62838741142984 123.42581651416742 125.02710196279864
58 125.46671839772387 125.95603098856618 122.65244777290924 124.30423938073771
59 124.8854788892308 125.30029111365572 121.93283650283469 123.6165638082452
60 124.25102134873799 124.7190065866159 121.40235333704597 123.06067996183094
61 123.65585065528447 124.34769278553169 121.1023751769949 122.72503398126331
62 123.19044231827388 124.29445218829295 121.07240719452062 122.6834296914068
63 122.93693600484033 124.62269190768171 121.35455585493793 122.98862388130983
64 122.96277994307508 125.31369770231268 122.01935494628607 123.66652632429938
65 123.31465313368723 126.34693034326854 123.07664673199426 124.71178853763142
66 124.01322083565933 127.74039798508545 124.01322083565933 126.08568841367331
67 125.04945462466631 129.3823041381943 125.04945462466631 127.71713432879321
68 126.38329447672976 131.13786227718913 126.38329447672976 129.5072998514451
69 127.94529716408744 132.931919609098 127.94529716408744 131.3378949243783
70 129.64159604423287 134.68441859501257 129.64159604423287 133.08247081963708
71 131.36203343193498 136.26935373189997 131.36203343193498 134.6195680915182
72 132.99080076172658 137.53305655655757 132.99080076172658 135.84607934436997
73 134.41844005304827 138.35930506780716 134.41844005304827 136.68901774755832
74 135.5537289003033 138.71240102143284 135.51562621069843 137.11401361606562
75 136.33387125818444 138.72150894756172 135.53708304236287 137.1292959949623
76 136.73158362657335 138.41548199354992 135.15367873584066 136.78458036469527
77 136.7580819956343 137.82969872626154 134.50040952054093 136.16505412340123
78 136.4615680595178 137.03478578006118 133.72797886517665 135.38138232261892
79 135.92147519106834 136.20144482542983 132.91297564494198 134.5572102351859
80 135.23934271312712 135.4539949084435 132.1778422865757 133.81591859750958
81 134.52763065531835 134.89979473030047 131.63691170758818 133.2683532189443