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 @@
k,d
nan,nan
nan,nan
nan,nan
nan,nan
nan,nan
nan,nan
nan,nan
nan,nan
22.979458250180002,61.258241405004455
14.841769766344251,51.195978117652885
20.343004679987718,41.96707667390497
26.62513409314209,34.21374802363955
27.915892596187984,28.180948640106035
26.935966889836763,24.658319761938596
29.10809017620745,24.10704520741233
36.882827969564076,26.093240881610054
56.2251820941338,32.00515692843713
63.352180211099615,38.14932486145312
71.01507103562844,44.49074442466546
72.21319166238689,50.81893000555101
74.85776509584265,57.664901177837564
80.83998783252585,65.05517227159734
87.94990387797992,72.35046882994246
87.09627236310574,76.76062458265274
82.85503157618153,79.54674620623587
80.82160510579344,80.94767964483086
80.3817752601529,82.11462015879745
77.74679981850821,82.52733940489252
50.4065455906804,78.1797047989146
32.595257632306684,70.27189819238986
22.935021118451605,61.10600515743926
15.494974746320857,51.48313989603059
14.546074791267413,42.01520699395545
17.254874709440188,32.99707834385363
18.814053107038298,24.57811452792936
22.00062350848595,20.520125659044435
32.16957522426709,20.459313886467353
61.289105905768054,25.93846885608399
70.26863041711735,33.763276809054915
79.87942281736457,43.096612241354514
86.56115446318677,52.9975093490326
86.43863691091089,62.65816417815724
80.48702879069397,71.01336493275839
77.42530443530895,77.47846910576438
77.8314096817614,79.84165535947771
79.09581163509131,81.1026812477597
75.47889053362475,80.474033778654
71.92815549662625,78.38360535485965
64.61505310749567,75.26595052580033
47.844470682892954,70.60272793897163
38.23407269428156,65.00398054739628
34.089367713893665,58.75511740912946
27.40185335748149,51.37026622661377
18.990479173603603,43.30049317518218
14.322208435121157,35.071072166395744
19.838623808844705,28.674439409445608
25.009963325065318,25.412366929755944
26.996330299071186,23.806975159011607
41.98373182796032,24.93474146102113
66.65852426164597,30.5428373044732
75.67203758770461,38.64020279220191
80.54460894039192,48.1005457215263
85.71879205927596,57.51199832873077
89.27819970571724,66.6931749545382
86.94905182640127,75.25784945844248
85.16379136066234,81.42642939168562
84.83869940893632,84.02359726986995
79.98672615389084,84.6399813507537
67.21733102610726,82.73608450585589
47.563403493162525,77.28531471069684
31.545376743680748,69.03776857326305
21.255433060536745,59.65296589242526
15.240009626740374,49.66385421615069
21.527288038268207,40.619366877483806
27.139852782304832,33.06981353868581
27.84355945441349,27.444989028443835
26.65939793906455,24.45870252071555
30.166635778770722,24.261739525728405
38.74716216215889,26.760557968817277
56.32783812074486,32.630247753675064
1 k d
2 nan nan
3 nan nan
4 nan nan
5 nan nan
6 nan nan
7 nan nan
8 nan nan
9 nan nan
10 22.979458250180002 61.258241405004455
11 14.841769766344251 51.195978117652885
12 20.343004679987718 41.96707667390497
13 26.62513409314209 34.21374802363955
14 27.915892596187984 28.180948640106035
15 26.935966889836763 24.658319761938596
16 29.10809017620745 24.10704520741233
17 36.882827969564076 26.093240881610054
18 56.2251820941338 32.00515692843713
19 63.352180211099615 38.14932486145312
20 71.01507103562844 44.49074442466546
21 72.21319166238689 50.81893000555101
22 74.85776509584265 57.664901177837564
23 80.83998783252585 65.05517227159734
24 87.94990387797992 72.35046882994246
25 87.09627236310574 76.76062458265274
26 82.85503157618153 79.54674620623587
27 80.82160510579344 80.94767964483086
28 80.3817752601529 82.11462015879745
29 77.74679981850821 82.52733940489252
30 50.4065455906804 78.1797047989146
31 32.595257632306684 70.27189819238986
32 22.935021118451605 61.10600515743926
33 15.494974746320857 51.48313989603059
34 14.546074791267413 42.01520699395545
35 17.254874709440188 32.99707834385363
36 18.814053107038298 24.57811452792936
37 22.00062350848595 20.520125659044435
38 32.16957522426709 20.459313886467353
39 61.289105905768054 25.93846885608399
40 70.26863041711735 33.763276809054915
41 79.87942281736457 43.096612241354514
42 86.56115446318677 52.9975093490326
43 86.43863691091089 62.65816417815724
44 80.48702879069397 71.01336493275839
45 77.42530443530895 77.47846910576438
46 77.8314096817614 79.84165535947771
47 79.09581163509131 81.1026812477597
48 75.47889053362475 80.474033778654
49 71.92815549662625 78.38360535485965
50 64.61505310749567 75.26595052580033
51 47.844470682892954 70.60272793897163
52 38.23407269428156 65.00398054739628
53 34.089367713893665 58.75511740912946
54 27.40185335748149 51.37026622661377
55 18.990479173603603 43.30049317518218
56 14.322208435121157 35.071072166395744
57 19.838623808844705 28.674439409445608
58 25.009963325065318 25.412366929755944
59 26.996330299071186 23.806975159011607
60 41.98373182796032 24.93474146102113
61 66.65852426164597 30.5428373044732
62 75.67203758770461 38.64020279220191
63 80.54460894039192 48.1005457215263
64 85.71879205927596 57.51199832873077
65 89.27819970571724 66.6931749545382
66 86.94905182640127 75.25784945844248
67 85.16379136066234 81.42642939168562
68 84.83869940893632 84.02359726986995
69 79.98672615389084 84.6399813507537
70 67.21733102610726 82.73608450585589
71 47.563403493162525 77.28531471069684
72 31.545376743680748 69.03776857326305
73 21.255433060536745 59.65296589242526
74 15.240009626740374 49.66385421615069
75 21.527288038268207 40.619366877483806
76 27.139852782304832 33.06981353868581
77 27.84355945441349 27.444989028443835
78 26.65939793906455 24.45870252071555
79 30.166635778770722 24.261739525728405
80 38.74716216215889 26.760557968817277
81 56.32783812074486 32.630247753675064