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
115.42223490063166,105.81052548732032,96.19881607400897
110.8531900491846,102.5361845205411,94.21917899189759
106.19067267959971,99.66058289617811,93.13049311275651
102.18219914264536,97.485253053946,92.78830696524663
100.0727492676429,96.249174240847,92.42559921405109
100.89458507967915,96.10742520677661,91.32026533387408
103.75467899990551,97.11733148165823,90.47998396341094
107.63859554704575,99.23334465658591,90.82809376612607
111.97591736820729,102.31111108753633,92.64630480686537
116.33722959274573,106.12036657646888,95.90350356019204
120.35257206636732,110.36550518635131,100.37843830633531
123.7176488204434,114.71198483912633,105.70632085780926
126.23086183285382,118.81621096319454,111.40156009353525
127.87826535693038,122.35622877318336,116.83419218943634
129.0857187495655,125.06048253206338,121.03524631456125
130.8670453222711,126.73207281637531,122.59710031047949
132.99927503480188,127.26634495531178,121.53341487582168
134.27598492450488,126.66023752077254,119.04449011704021
134.1622901612134,125.01255579561924,115.86282143002505
132.5668387181173,122.51514579202414,112.46345286593096
129.62920101989414,119.43575721856833,109.24231341724251
125.65050860465828,116.09412619620025,106.53774378774222
121.06057518232433,112.83341418280601,104.60625318328769
116.41209463243416,109.98955438219666,103.56701413195916
112.47082504761673,107.86124383150641,103.2516626153961
110.51349335532025,106.68326168445915,102.85303001359806
111.48546253126406,106.60549708879844,101.72553164633283
114.42376900880853,107.67956003512641,100.9353510614443
118.34601987553009,109.85417119015123,101.36232250477238
122.69539253586646,112.97974252680737,103.26409251774828
127.04659008585104,116.82173957720215,106.59688906855327
131.03279487427605,121.08163169813083,111.13046852198562
134.35423987831632,125.42355892433378,116.49287797035123
136.81684868556786,129.50433333891905,122.19181799227026
138.42211353777907,133.00409502787733,127.58607651797558
139.63336255195725,135.6548842135778,131.67640587519833
141.461983562285,137.26457730365246,133.0671710450199
143.573521209777,137.73404871930973,131.89457622884245
144.7805951256023,137.06602548806697,129.35145585053164
144.58359708046436,135.3648436465045,126.14609021254466
142.90751688267724,132.8271282128569,122.74673954303657
139.90225076333562,129.72422925973203,119.54620775612844
135.87683244397408,126.3779830202745,116.87913359657493
131.2677308407553,123.13196321596729,114.99619559117927
126.63559938051972,120.32079063934128,114.00598189816284
122.76557432685047,118.24024247516277,113.71491062347508
120.96433428327445,117.1208314054171,113.27732852755976
122.0823303991086,117.10721459795151,112.13209879679442
125.0958465842453,118.24527191249732,111.39469724074934
129.05475994494066,120.47800758944088,111.9012552339411
133.4148602471883,123.65064151128308,113.88642277537787
137.7547872283839,127.52443524956087,117.29408327073784
141.7109030205324,131.79801785763928,121.88513269474615
144.98808700731516,136.13430643981556,127.28052587231598
147.4000360361705,140.19061676247512,132.98119748877974
148.96446440948932,143.64927421608036,138.3340840226714
150.18345631752632,146.2459907419256,142.30852516632487
152.05797742412273,147.7934728973059,143.52896837048905
154.14468995984444,148.19815222094596,142.25161448204747
155.2806968493626,147.4685434249762,139.65639000058977
155.00020229220343,145.71448380105656,136.4287653099097
153.24397867467368,143.13732178223626,133.03066488979883
150.17206312494991,140.01193108709475,129.8517990492396
146.10129286063778,136.6621570691049,127.22302127757202
141.47476631158332,133.43188857569947,125.38901083981564
136.8613501625982,130.65433938171788,124.44732860083757
133.0667562797099,128.62228319529356,124.17781011087723
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 115.42223490063166 105.81052548732032 96.19881607400897
16 110.8531900491846 102.5361845205411 94.21917899189759
17 106.19067267959971 99.66058289617811 93.13049311275651
18 102.18219914264536 97.485253053946 92.78830696524663
19 100.0727492676429 96.249174240847 92.42559921405109
20 100.89458507967915 96.10742520677661 91.32026533387408
21 103.75467899990551 97.11733148165823 90.47998396341094
22 107.63859554704575 99.23334465658591 90.82809376612607
23 111.97591736820729 102.31111108753633 92.64630480686537
24 116.33722959274573 106.12036657646888 95.90350356019204
25 120.35257206636732 110.36550518635131 100.37843830633531
26 123.7176488204434 114.71198483912633 105.70632085780926
27 126.23086183285382 118.81621096319454 111.40156009353525
28 127.87826535693038 122.35622877318336 116.83419218943634
29 129.0857187495655 125.06048253206338 121.03524631456125
30 130.8670453222711 126.73207281637531 122.59710031047949
31 132.99927503480188 127.26634495531178 121.53341487582168
32 134.27598492450488 126.66023752077254 119.04449011704021
33 134.1622901612134 125.01255579561924 115.86282143002505
34 132.5668387181173 122.51514579202414 112.46345286593096
35 129.62920101989414 119.43575721856833 109.24231341724251
36 125.65050860465828 116.09412619620025 106.53774378774222
37 121.06057518232433 112.83341418280601 104.60625318328769
38 116.41209463243416 109.98955438219666 103.56701413195916
39 112.47082504761673 107.86124383150641 103.2516626153961
40 110.51349335532025 106.68326168445915 102.85303001359806
41 111.48546253126406 106.60549708879844 101.72553164633283
42 114.42376900880853 107.67956003512641 100.9353510614443
43 118.34601987553009 109.85417119015123 101.36232250477238
44 122.69539253586646 112.97974252680737 103.26409251774828
45 127.04659008585104 116.82173957720215 106.59688906855327
46 131.03279487427605 121.08163169813083 111.13046852198562
47 134.35423987831632 125.42355892433378 116.49287797035123
48 136.81684868556786 129.50433333891905 122.19181799227026
49 138.42211353777907 133.00409502787733 127.58607651797558
50 139.63336255195725 135.6548842135778 131.67640587519833
51 141.461983562285 137.26457730365246 133.0671710450199
52 143.573521209777 137.73404871930973 131.89457622884245
53 144.7805951256023 137.06602548806697 129.35145585053164
54 144.58359708046436 135.3648436465045 126.14609021254466
55 142.90751688267724 132.8271282128569 122.74673954303657
56 139.90225076333562 129.72422925973203 119.54620775612844
57 135.87683244397408 126.3779830202745 116.87913359657493
58 131.2677308407553 123.13196321596729 114.99619559117927
59 126.63559938051972 120.32079063934128 114.00598189816284
60 122.76557432685047 118.24024247516277 113.71491062347508
61 120.96433428327445 117.1208314054171 113.27732852755976
62 122.0823303991086 117.10721459795151 112.13209879679442
63 125.0958465842453 118.24527191249732 111.39469724074934
64 129.05475994494066 120.47800758944088 111.9012552339411
65 133.4148602471883 123.65064151128308 113.88642277537787
66 137.7547872283839 127.52443524956087 117.29408327073784
67 141.7109030205324 131.79801785763928 121.88513269474615
68 144.98808700731516 136.13430643981556 127.28052587231598
69 147.4000360361705 140.19061676247512 132.98119748877974
70 148.96446440948932 143.64927421608036 138.3340840226714
71 150.18345631752632 146.2459907419256 142.30852516632487
72 152.05797742412273 147.7934728973059 143.52896837048905
73 154.14468995984444 148.19815222094596 142.25161448204747
74 155.2806968493626 147.4685434249762 139.65639000058977
75 155.00020229220343 145.71448380105656 136.4287653099097
76 153.24397867467368 143.13732178223626 133.03066488979883
77 150.17206312494991 140.01193108709475 129.8517990492396
78 146.10129286063778 136.6621570691049 127.22302127757202
79 141.47476631158332 133.43188857569947 125.38901083981564
80 136.8613501625982 130.65433938171788 124.44732860083757
81 133.0667562797099 128.62228319529356 124.17781011087723