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 @@
EwmaVolatility
nan
0.03396850274500474
0.03376396213068082
0.03329791438067671
0.03258360553899256
0.03169191753288074
0.030731800820399446
0.02982485796098939
0.029074344774969313
0.02853313113138286
0.028181993760619195
0.027931580630350335
0.027653052097001567
0.02722888888171916
0.02660638016397493
0.025833724473256273
0.025059021262119577
0.02447875060673666
0.02424601565043995
0.024387880532315772
0.024791658346381275
0.025265920317677527
0.02562263996002066
0.02573219419923383
0.025542535595650437
0.025075414023296064
0.024411905741723607
0.023672032390293835
0.02298776526369364
0.022468621473095186
0.022165808543500736
0.022050231284750338
0.022019963256440202
0.021938606468945347
0.021689915673056104
0.021229270428067482
0.02061505555207214
0.02000394869232789
0.019596977985609533
0.019544702296967302
0.019863507928403464
0.020428135050559505
0.021041385911669284
0.021518122629506142
0.02173593021656738
0.021649783293554284
0.021286317337150567
0.020729359697824034
0.020100095770100575
0.019530059461596572
0.01912586088747622
0.018932814446056687
0.018914884667409787
0.018966511456709193
0.01895422640673899
0.01877027028034217
0.01837941995604381
0.017845240992843046
0.017322629833587247
0.01700446422892337
0.01703001467055171
0.0174064574652337
0.018006761241761707
0.018640406428931406
0.0191330708923154
0.019372110743296075
0.01931853851981927
0.019001008741153697
0.018502137047678707
0.0179395273637584
0.01743928715125553
0.017101181693674732
0.01696351405019204
0.01698581715035046
0.01706364199352184
0.017070709461754634
0.016909594613820435
0.01655365293563265
0.016068806538512285
0.01560407200355932
1 EwmaVolatility
2 nan
3 0.03396850274500474
4 0.03376396213068082
5 0.03329791438067671
6 0.03258360553899256
7 0.03169191753288074
8 0.030731800820399446
9 0.02982485796098939
10 0.029074344774969313
11 0.02853313113138286
12 0.028181993760619195
13 0.027931580630350335
14 0.027653052097001567
15 0.02722888888171916
16 0.02660638016397493
17 0.025833724473256273
18 0.025059021262119577
19 0.02447875060673666
20 0.02424601565043995
21 0.024387880532315772
22 0.024791658346381275
23 0.025265920317677527
24 0.02562263996002066
25 0.02573219419923383
26 0.025542535595650437
27 0.025075414023296064
28 0.024411905741723607
29 0.023672032390293835
30 0.02298776526369364
31 0.022468621473095186
32 0.022165808543500736
33 0.022050231284750338
34 0.022019963256440202
35 0.021938606468945347
36 0.021689915673056104
37 0.021229270428067482
38 0.02061505555207214
39 0.02000394869232789
40 0.019596977985609533
41 0.019544702296967302
42 0.019863507928403464
43 0.020428135050559505
44 0.021041385911669284
45 0.021518122629506142
46 0.02173593021656738
47 0.021649783293554284
48 0.021286317337150567
49 0.020729359697824034
50 0.020100095770100575
51 0.019530059461596572
52 0.01912586088747622
53 0.018932814446056687
54 0.018914884667409787
55 0.018966511456709193
56 0.01895422640673899
57 0.01877027028034217
58 0.01837941995604381
59 0.017845240992843046
60 0.017322629833587247
61 0.01700446422892337
62 0.01703001467055171
63 0.0174064574652337
64 0.018006761241761707
65 0.018640406428931406
66 0.0191330708923154
67 0.019372110743296075
68 0.01931853851981927
69 0.019001008741153697
70 0.018502137047678707
71 0.0179395273637584
72 0.01743928715125553
73 0.017101181693674732
74 0.01696351405019204
75 0.01698581715035046
76 0.01706364199352184
77 0.017070709461754634
78 0.016909594613820435
79 0.01655365293563265
80 0.016068806538512285
81 0.01560407200355932