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 @@
HeikinAshiOscillator
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
0.2603038586325478
-0.22971477074983737
-0.47419652333367374
-0.47389581268250686
-0.2512717572856119
0.15329160084773533
0.6868910022142485
1.2901446933824066
1.9029485381687865
2.4692727440047326
2.9406676473820945
3.2784951149694486
3.455167205797046
3.4547952227509184
3.2736113770841944
2.9203486448207308
2.416516079510151
1.7962708125256655
1.1054454303484227
0.39929686424196315
-0.26128361694479757
-0.8150502240504445
-1.2067473887812363
-1.3937454107077667
-1.3519638827123523
-1.0800408599769915
-0.6008855939074966
0.039870476074616794
0.7785046187808641
1.5403632703471488
2.2485504883792746
2.832871624317509
3.237723478308697
3.427827932356933
3.39110777760319
3.1385140890160765
2.7011259250471165
2.12525111647958
1.4664847822863094
0.7836975435242642
0.13374587239035093
-0.43261585468467245
-0.8734994767293598
-1.1575100762810129
-1.2646086657077076
-1.1866091603328575
-0.9275820776568309
-0.5042093100179962
0.054117417738707166
0.7058519836576325
1.398960259386399
2.0740491193972574
2.669050373325719
3.1251932880210136
3.393627285155775
3.4417670302871146
3.2583079471484213
2.855948765199865
2.271158519392332
1.5607880973269848
0.7958610008005166
0.05337483360824679
-0.5927001894782721
-1.0799017451780017
-1.3640188297243794
-1.4232108062805398
-1.2590925682819876
1 HeikinAshiOscillator
2 nan
3 nan
4 nan
5 nan
6 nan
7 nan
8 nan
9 nan
10 nan
11 nan
12 nan
13 nan
14 nan
15 0.2603038586325478
16 -0.22971477074983737
17 -0.47419652333367374
18 -0.47389581268250686
19 -0.2512717572856119
20 0.15329160084773533
21 0.6868910022142485
22 1.2901446933824066
23 1.9029485381687865
24 2.4692727440047326
25 2.9406676473820945
26 3.2784951149694486
27 3.455167205797046
28 3.4547952227509184
29 3.2736113770841944
30 2.9203486448207308
31 2.416516079510151
32 1.7962708125256655
33 1.1054454303484227
34 0.39929686424196315
35 -0.26128361694479757
36 -0.8150502240504445
37 -1.2067473887812363
38 -1.3937454107077667
39 -1.3519638827123523
40 -1.0800408599769915
41 -0.6008855939074966
42 0.039870476074616794
43 0.7785046187808641
44 1.5403632703471488
45 2.2485504883792746
46 2.832871624317509
47 3.237723478308697
48 3.427827932356933
49 3.39110777760319
50 3.1385140890160765
51 2.7011259250471165
52 2.12525111647958
53 1.4664847822863094
54 0.7836975435242642
55 0.13374587239035093
56 -0.43261585468467245
57 -0.8734994767293598
58 -1.1575100762810129
59 -1.2646086657077076
60 -1.1866091603328575
61 -0.9275820776568309
62 -0.5042093100179962
63 0.054117417738707166
64 0.7058519836576325
65 1.398960259386399
66 2.0740491193972574
67 2.669050373325719
68 3.1251932880210136
69 3.393627285155775
70 3.4417670302871146
71 3.2583079471484213
72 2.855948765199865
73 2.271158519392332
74 1.5607880973269848
75 0.7958610008005166
76 0.05337483360824679
77 -0.5927001894782721
78 -1.0799017451780017
79 -1.3640188297243794
80 -1.4232108062805398
81 -1.2590925682819876