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 @@
Alma
nan
nan
nan
nan
nan
nan
nan
nan
111.94970536775864
111.06893157832275
109.531823102842
107.52034877441032
105.25885111498506
102.9940064860489
100.97279022390286
99.42041506842905
98.52021357977716
98.39726158677666
99.10720553565477
100.63129175872405
102.87804168366374
105.69142334193903
108.86478923984795
112.1593355636855
115.32543381320428
118.12492937208509
120.35241515052857
121.85357998883293
122.5389928137129
122.39209124972787
121.47066108695326
119.90167444845366
117.86994774868424
115.6016325936173
113.344014331317
111.3434227882747
109.82322835964058
108.96388899707799
108.88683043739061
109.64359960308988
111.211260069327
113.49444090641407
116.33385588093464
119.5205320205802
122.81447654739276
125.96611471786073
128.7385835914609
130.92889029169768
132.3860447551969
133.02454722438065
132.83202568617187
131.87034102707568
130.27006118442495
128.21879790140275
125.94444792877846
123.69483568689546
121.71557584828516
120.22813331047199
119.41004039625565
119.37903842005129
120.18256020693593
121.79349305965133
124.11260065510152
126.97738752954433
130.17661431441516
133.469167119997
136.6055955210909
139.35039522057332
141.50304494686682
142.91591842192776
143.5074713769954
143.26952565926126
142.26799976190287
140.63702052140982
138.56694196674394
136.28734156085395
134.0465127296497
132.08928554974582
130.63515680688343
129.858683001776
1 Alma
2 nan
3 nan
4 nan
5 nan
6 nan
7 nan
8 nan
9 nan
10 111.94970536775864
11 111.06893157832275
12 109.531823102842
13 107.52034877441032
14 105.25885111498506
15 102.9940064860489
16 100.97279022390286
17 99.42041506842905
18 98.52021357977716
19 98.39726158677666
20 99.10720553565477
21 100.63129175872405
22 102.87804168366374
23 105.69142334193903
24 108.86478923984795
25 112.1593355636855
26 115.32543381320428
27 118.12492937208509
28 120.35241515052857
29 121.85357998883293
30 122.5389928137129
31 122.39209124972787
32 121.47066108695326
33 119.90167444845366
34 117.86994774868424
35 115.6016325936173
36 113.344014331317
37 111.3434227882747
38 109.82322835964058
39 108.96388899707799
40 108.88683043739061
41 109.64359960308988
42 111.211260069327
43 113.49444090641407
44 116.33385588093464
45 119.5205320205802
46 122.81447654739276
47 125.96611471786073
48 128.7385835914609
49 130.92889029169768
50 132.3860447551969
51 133.02454722438065
52 132.83202568617187
53 131.87034102707568
54 130.27006118442495
55 128.21879790140275
56 125.94444792877846
57 123.69483568689546
58 121.71557584828516
59 120.22813331047199
60 119.41004039625565
61 119.37903842005129
62 120.18256020693593
63 121.79349305965133
64 124.11260065510152
65 126.97738752954433
66 130.17661431441516
67 133.469167119997
68 136.6055955210909
69 139.35039522057332
70 141.50304494686682
71 142.91591842192776
72 143.5074713769954
73 143.26952565926126
74 142.26799976190287
75 140.63702052140982
76 138.56694196674394
77 136.28734156085395
78 134.0465127296497
79 132.08928554974582
80 130.63515680688343
81 129.858683001776