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 @@
fast,slow
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
32.45362805890103,41.920277092145845
33.56092803656679,39.83043982825108
39.226991550958545,39.67957775892795
45.258288715993814,41.07425549819442
51.69748429590247,43.730062697621435
56.82641113752357,47.00414980759697
61.33424962710335,50.586674762473564
66.21068417845896,54.49267711646991
71.6454891033392,58.78088011318724
75.50818491828083,62.96270631446063
77.34489658275601,66.55825388153448
78.21407371351536,69.4722088395297
78.75599910017475,71.79315640469096
78.50369927975811,73.47079212345776
71.47941085748869,72.9729468069655
61.75837255119319,70.16930324302243
52.05253469300779,65.64011110551877
42.913144706336055,59.95836950572309
35.821377227568895,53.92412143618454
31.17975159803672,48.238028976647584
28.088326975287117,43.20060347630747
26.566401108586824,39.04205288437731
27.96719463750689,36.273338322659704
36.29767245457218,36.27942185563782
44.790411945208476,38.40716937803049
53.5626646632475,42.19604319933474
61.812287113232316,47.10010417780913
67.96887456265196,52.31729677401984
71.09841311966247,57.012575860430495
72.68013594857409,60.92946588246639
73.96795438187091,64.18908800731752
75.249918695176,66.95429567928214
75.30716165478819,69.04251217315866
74.4624101152477,70.39748665868092
72.00057086330969,70.79825770983811
65.96154581820551,69.58907973692996
59.02967753722452,66.9492291870036
52.794600081391806,63.41057191060065
46.44641340041422,59.169532283054046
39.582429843711566,54.272756673218424
33.26737449156396,49.02141112780481
29.910186820884146,44.243605051074645
28.685130946929437,40.353986525038344
28.262930784964876,37.331222590019976
31.693131045713734,35.92169970394342
40.434479349696794,37.04989461538176
49.243868909198746,40.098388188836005
57.06905391699704,44.341054620876264
64.23148845256677,49.31366307879889
70.49316626585438,54.60853887556276
74.60713765599111,59.60818857066984
77.24630108215892,64.01771669854212
79.14440066385328,67.7993876898699
79.35498203636267,70.6882862764931
76.32056928379882,72.09635702831953
69.13127783613974,71.35508723027459
59.73480256302499,68.45001606346219
50.11496018740293,63.866252094447375
41.396222547237294,58.24874470764486
36.42898891999502,52.793805760732404
34.106704885572476,48.12203054194242
32.54091852778273,44.2267525384025
31.070538380603182,40.93769899895267
30.844562730145068,38.41441493175077
32.82021258814852,37.015864345850204
38.697118971297606,37.43617800221205
1 fast slow
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 nan nan
11 nan nan
12 nan nan
13 nan nan
14 nan nan
15 nan nan
16 32.45362805890103 41.920277092145845
17 33.56092803656679 39.83043982825108
18 39.226991550958545 39.67957775892795
19 45.258288715993814 41.07425549819442
20 51.69748429590247 43.730062697621435
21 56.82641113752357 47.00414980759697
22 61.33424962710335 50.586674762473564
23 66.21068417845896 54.49267711646991
24 71.6454891033392 58.78088011318724
25 75.50818491828083 62.96270631446063
26 77.34489658275601 66.55825388153448
27 78.21407371351536 69.4722088395297
28 78.75599910017475 71.79315640469096
29 78.50369927975811 73.47079212345776
30 71.47941085748869 72.9729468069655
31 61.75837255119319 70.16930324302243
32 52.05253469300779 65.64011110551877
33 42.913144706336055 59.95836950572309
34 35.821377227568895 53.92412143618454
35 31.17975159803672 48.238028976647584
36 28.088326975287117 43.20060347630747
37 26.566401108586824 39.04205288437731
38 27.96719463750689 36.273338322659704
39 36.29767245457218 36.27942185563782
40 44.790411945208476 38.40716937803049
41 53.5626646632475 42.19604319933474
42 61.812287113232316 47.10010417780913
43 67.96887456265196 52.31729677401984
44 71.09841311966247 57.012575860430495
45 72.68013594857409 60.92946588246639
46 73.96795438187091 64.18908800731752
47 75.249918695176 66.95429567928214
48 75.30716165478819 69.04251217315866
49 74.4624101152477 70.39748665868092
50 72.00057086330969 70.79825770983811
51 65.96154581820551 69.58907973692996
52 59.02967753722452 66.9492291870036
53 52.794600081391806 63.41057191060065
54 46.44641340041422 59.169532283054046
55 39.582429843711566 54.272756673218424
56 33.26737449156396 49.02141112780481
57 29.910186820884146 44.243605051074645
58 28.685130946929437 40.353986525038344
59 28.262930784964876 37.331222590019976
60 31.693131045713734 35.92169970394342
61 40.434479349696794 37.04989461538176
62 49.243868909198746 40.098388188836005
63 57.06905391699704 44.341054620876264
64 64.23148845256677 49.31366307879889
65 70.49316626585438 54.60853887556276
66 74.60713765599111 59.60818857066984
67 77.24630108215892 64.01771669854212
68 79.14440066385328 67.7993876898699
69 79.35498203636267 70.6882862764931
70 76.32056928379882 72.09635702831953
71 69.13127783613974 71.35508723027459
72 59.73480256302499 68.45001606346219
73 50.11496018740293 63.866252094447375
74 41.396222547237294 58.24874470764486
75 36.42898891999502 52.793805760732404
76 34.106704885572476 48.12203054194242
77 32.54091852778273 44.2267525384025
78 31.070538380603182 40.93769899895267
79 30.844562730145068 38.41441493175077
80 32.82021258814852 37.015864345850204
81 38.697118971297606 37.43617800221205