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 @@
current,min,median,max,percentile
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,nan,nan
nan,nan,nan,nan,nan
nan,nan,nan,nan,nan
nan,nan,nan,nan,nan
0.006337574671501262,0.004576685171584879,0.007285744693342858,0.007855949166258326,42.857142857142854
0.004826875512043472,0.004826875512043472,0.007285744693342858,0.007855949166258326,14.285714285714285
0.002880501207525251,0.002880501207525251,0.007285744693342858,0.007855949166258326,14.285714285714285
0.0008529543889747591,0.0008529543889747591,0.006337574671501262,0.007855949166258326,14.285714285714285
0.0022590633404344783,0.0008529543889747591,0.004826875512043472,0.007855949166258326,28.57142857142857
0.004716953223469401,0.0008529543889747591,0.004716953223469401,0.007353623744580629,57.14285714285714
0.006872364512399864,0.0008529543889747591,0.004716953223469401,0.006872364512399864,100
0.008369605111376946,0.0008529543889747591,0.004716953223469401,0.008369605111376946,100
0.008955254857309513,0.0008529543889747591,0.004716953223469401,0.008955254857309513,100
0.008528955976895892,0.0008529543889747591,0.006872364512399864,0.008955254857309513,85.71428571428571
0.00717395343671726,0.0022590633404344783,0.00717395343671726,0.008955254857309513,57.14285714285714
0.005130873608513178,0.004716953223469401,0.00717395343671726,0.008955254857309513,28.57142857142857
0.0027380539481836165,0.0027380539481836165,0.00717395343671726,0.008955254857309513,14.285714285714285
0.0007238575095366861,0.0007238575095366861,0.00717395343671726,0.008955254857309513,14.285714285714285
0.002284637499047382,0.0007238575095366861,0.005130873608513178,0.008955254857309513,28.57142857142857
0.004186540551561933,0.0007238575095366861,0.004186540551561933,0.008528955976895892,57.14285714285714
0.0056708616874650225,0.0007238575095366861,0.004186540551561933,0.00717395343671726,85.71428571428571
0.006670171807647695,0.0007238575095366861,0.004186540551561933,0.006670171807647695,100
0.007169785700086379,0.0007238575095366861,0.004186540551561933,0.007169785700086379,100
0.007171701829605531,0.0007238575095366861,0.0056708616874650225,0.007171701829605531,100
0.0066827670014637025,0.002284637499047382,0.006670171807647695,0.007171701829605531,71.42857142857143
0.005714147160681101,0.004186540551561933,0.006670171807647695,0.007171701829605531,42.857142857142854
0.004291243113585006,0.004291243113585006,0.006670171807647695,0.007171701829605531,14.285714285714285
0.002481167937686481,0.002481167937686481,0.006670171807647695,0.007171701829605531,14.285714285714285
0.0007055329922055471,0.0007055329922055471,0.005714147160681101,0.007171701829605531,14.285714285714285
0.00221157656665784,0.0007055329922055471,0.004291243113585006,0.007171701829605531,28.57142857142857
0.004419870324472836,0.0007055329922055471,0.004291243113585006,0.0066827670014637025,71.42857142857143
0.0063232815623185,0.0007055329922055471,0.004291243113585006,0.0063232815623185,100
0.007619410578846894,0.0007055329922055471,0.004291243113585006,0.007619410578846894,100
0.008097262995564182,0.0007055329922055471,0.004419870324472836,0.008097262995564182,100
0.007678845715853397,0.0007055329922055471,0.0063232815623185,0.008097262995564182,85.71428571428571
0.006441560166629998,0.00221157656665784,0.006441560166629998,0.008097262995564182,57.14285714285714
0.004595316526557396,0.004419870324472836,0.006441560166629998,0.008097262995564182,28.57142857142857
0.0024352766879582257,0.0024352766879582257,0.006441560166629998,0.008097262995564182,14.285714285714285
0.0006513051215166925,0.0006513051215166925,0.006441560166629998,0.008097262995564182,14.285714285714285
0.0021296195701274523,0.0006513051215166925,0.004595316526557396,0.008097262995564182,28.57142857142857
0.0038739136438890177,0.0006513051215166925,0.0038739136438890177,0.007678845715853397,57.14285714285714
0.005239316967882262,0.0006513051215166925,0.0038739136438890177,0.006441560166629998,85.71428571428571
0.006157914525810147,0.0006513051215166925,0.0038739136438890177,0.006157914525810147,100
0.006610122187369184,0.0006513051215166925,0.0038739136438890177,0.006610122187369184,100
0.00659408724645429,0.0006513051215166925,0.005239316967882262,0.006610122187369184,85.71428571428571
0.006115686774801471,0.0021296195701274523,0.006115686774801471,0.006610122187369184,57.14285714285714
0.005188372455960907,0.0038739136438890177,0.006115686774801471,0.006610122187369184,28.57142857142857
0.0038423081340976106,0.0038423081340976106,0.006115686774801471,0.006610122187369184,14.285714285714285
0.002150656456710158,0.002150656456710158,0.006115686774801471,0.006610122187369184,14.285714285714285
0.0006162442091532034,0.0006162442091532034,0.005188372455960907,0.006610122187369184,14.285714285714285
0.0021663150644263543,0.0006162442091532034,0.0038423081340976106,0.00659408724645429,42.857142857142854
0.004166852744770461,0.0006162442091532034,0.0038423081340976106,0.006115686774801471,71.42857142857143
0.0058641581511040776,0.0006162442091532034,0.0038423081340976106,0.0058641581511040776,100
0.006997270043013378,0.0006162442091532034,0.0038423081340976106,0.006997270043013378,100
0.007387906536955508,0.0006162442091532034,0.004166852744770461,0.007387906536955508,100
0.0069750445812033065,0.0006162442091532034,0.0058641581511040776,0.007387906536955508,71.42857142857143
0.005831533134420141,0.0021663150644263543,0.0058641581511040776,0.007387906536955508,42.857142857142854
0.004143778769158221,0.004143778769158221,0.0058641581511040776,0.007387906536955508,14.285714285714285
0.002173765042541486,0.002173765042541486,0.0058641581511040776,0.007387906536955508,14.285714285714285
0.0005938446829842412,0.0005938446829842412,0.005831533134420141,0.007387906536955508,14.285714285714285
0.002009178107907748,0.0005938446829842412,0.004143778769158221,0.007387906536955508,28.57142857142857
0.003617978029873307,0.0005938446829842412,0.003617978029873307,0.0069750445812033065,57.14285714285714
0.00487874797973096,0.0005938446829842412,0.003617978029873307,0.005831533134420141,85.71428571428571
0.005724647981048404,0.0005938446829842412,0.003617978029873307,0.005724647981048404,100
0.006133061820877019,0.0005938446829842412,0.003617978029873307,0.006133061820877019,100
0.00609960702050407,0.0005938446829842412,0.00487874797973096,0.006133061820877019,85.71428571428571
0.005629692701650538,0.002009178107907748,0.005629692701650538,0.006133061820877019,57.14285714285714
0.0047386912098765655,0.003617978029873307,0.005629692701650538,0.006133061820877019,28.57142857142857
0.0034604186725466744,0.0034604186725466744,0.005629692701650538,0.006133061820877019,14.285714285714285
0.0018727317079909123,0.0018727317079909123,0.005629692701650538,0.006133061820877019,14.285714285714285
0.0005726849313975644,0.0005726849313975644,0.0047386912098765655,0.006133061820877019,14.285714285714285
0.0021237644047560305,0.0005726849313975644,0.0034604186725466744,0.00609960702050407,42.857142857142854
0.0039486491976884145,0.0005726849313975644,0.0034604186725466744,0.005629692701650538,71.42857142857143
0.005474218145085102,0.0005726849313975644,0.0034604186725466744,0.005474218145085102,100
0.006472536350968328,0.0005726849313975644,0.0034604186725466744,0.006472536350968328,100
1 current min median max percentile
2 nan nan nan nan nan
3 nan nan nan nan nan
4 nan nan nan nan nan
5 nan nan nan nan nan
6 nan nan nan nan nan
7 nan nan nan nan nan
8 nan nan nan nan nan
9 nan nan nan nan nan
10 nan nan nan nan nan
11 0.006337574671501262 0.004576685171584879 0.007285744693342858 0.007855949166258326 42.857142857142854
12 0.004826875512043472 0.004826875512043472 0.007285744693342858 0.007855949166258326 14.285714285714285
13 0.002880501207525251 0.002880501207525251 0.007285744693342858 0.007855949166258326 14.285714285714285
14 0.0008529543889747591 0.0008529543889747591 0.006337574671501262 0.007855949166258326 14.285714285714285
15 0.0022590633404344783 0.0008529543889747591 0.004826875512043472 0.007855949166258326 28.57142857142857
16 0.004716953223469401 0.0008529543889747591 0.004716953223469401 0.007353623744580629 57.14285714285714
17 0.006872364512399864 0.0008529543889747591 0.004716953223469401 0.006872364512399864 100
18 0.008369605111376946 0.0008529543889747591 0.004716953223469401 0.008369605111376946 100
19 0.008955254857309513 0.0008529543889747591 0.004716953223469401 0.008955254857309513 100
20 0.008528955976895892 0.0008529543889747591 0.006872364512399864 0.008955254857309513 85.71428571428571
21 0.00717395343671726 0.0022590633404344783 0.00717395343671726 0.008955254857309513 57.14285714285714
22 0.005130873608513178 0.004716953223469401 0.00717395343671726 0.008955254857309513 28.57142857142857
23 0.0027380539481836165 0.0027380539481836165 0.00717395343671726 0.008955254857309513 14.285714285714285
24 0.0007238575095366861 0.0007238575095366861 0.00717395343671726 0.008955254857309513 14.285714285714285
25 0.002284637499047382 0.0007238575095366861 0.005130873608513178 0.008955254857309513 28.57142857142857
26 0.004186540551561933 0.0007238575095366861 0.004186540551561933 0.008528955976895892 57.14285714285714
27 0.0056708616874650225 0.0007238575095366861 0.004186540551561933 0.00717395343671726 85.71428571428571
28 0.006670171807647695 0.0007238575095366861 0.004186540551561933 0.006670171807647695 100
29 0.007169785700086379 0.0007238575095366861 0.004186540551561933 0.007169785700086379 100
30 0.007171701829605531 0.0007238575095366861 0.0056708616874650225 0.007171701829605531 100
31 0.0066827670014637025 0.002284637499047382 0.006670171807647695 0.007171701829605531 71.42857142857143
32 0.005714147160681101 0.004186540551561933 0.006670171807647695 0.007171701829605531 42.857142857142854
33 0.004291243113585006 0.004291243113585006 0.006670171807647695 0.007171701829605531 14.285714285714285
34 0.002481167937686481 0.002481167937686481 0.006670171807647695 0.007171701829605531 14.285714285714285
35 0.0007055329922055471 0.0007055329922055471 0.005714147160681101 0.007171701829605531 14.285714285714285
36 0.00221157656665784 0.0007055329922055471 0.004291243113585006 0.007171701829605531 28.57142857142857
37 0.004419870324472836 0.0007055329922055471 0.004291243113585006 0.0066827670014637025 71.42857142857143
38 0.0063232815623185 0.0007055329922055471 0.004291243113585006 0.0063232815623185 100
39 0.007619410578846894 0.0007055329922055471 0.004291243113585006 0.007619410578846894 100
40 0.008097262995564182 0.0007055329922055471 0.004419870324472836 0.008097262995564182 100
41 0.007678845715853397 0.0007055329922055471 0.0063232815623185 0.008097262995564182 85.71428571428571
42 0.006441560166629998 0.00221157656665784 0.006441560166629998 0.008097262995564182 57.14285714285714
43 0.004595316526557396 0.004419870324472836 0.006441560166629998 0.008097262995564182 28.57142857142857
44 0.0024352766879582257 0.0024352766879582257 0.006441560166629998 0.008097262995564182 14.285714285714285
45 0.0006513051215166925 0.0006513051215166925 0.006441560166629998 0.008097262995564182 14.285714285714285
46 0.0021296195701274523 0.0006513051215166925 0.004595316526557396 0.008097262995564182 28.57142857142857
47 0.0038739136438890177 0.0006513051215166925 0.0038739136438890177 0.007678845715853397 57.14285714285714
48 0.005239316967882262 0.0006513051215166925 0.0038739136438890177 0.006441560166629998 85.71428571428571
49 0.006157914525810147 0.0006513051215166925 0.0038739136438890177 0.006157914525810147 100
50 0.006610122187369184 0.0006513051215166925 0.0038739136438890177 0.006610122187369184 100
51 0.00659408724645429 0.0006513051215166925 0.005239316967882262 0.006610122187369184 85.71428571428571
52 0.006115686774801471 0.0021296195701274523 0.006115686774801471 0.006610122187369184 57.14285714285714
53 0.005188372455960907 0.0038739136438890177 0.006115686774801471 0.006610122187369184 28.57142857142857
54 0.0038423081340976106 0.0038423081340976106 0.006115686774801471 0.006610122187369184 14.285714285714285
55 0.002150656456710158 0.002150656456710158 0.006115686774801471 0.006610122187369184 14.285714285714285
56 0.0006162442091532034 0.0006162442091532034 0.005188372455960907 0.006610122187369184 14.285714285714285
57 0.0021663150644263543 0.0006162442091532034 0.0038423081340976106 0.00659408724645429 42.857142857142854
58 0.004166852744770461 0.0006162442091532034 0.0038423081340976106 0.006115686774801471 71.42857142857143
59 0.0058641581511040776 0.0006162442091532034 0.0038423081340976106 0.0058641581511040776 100
60 0.006997270043013378 0.0006162442091532034 0.0038423081340976106 0.006997270043013378 100
61 0.007387906536955508 0.0006162442091532034 0.004166852744770461 0.007387906536955508 100
62 0.0069750445812033065 0.0006162442091532034 0.0058641581511040776 0.007387906536955508 71.42857142857143
63 0.005831533134420141 0.0021663150644263543 0.0058641581511040776 0.007387906536955508 42.857142857142854
64 0.004143778769158221 0.004143778769158221 0.0058641581511040776 0.007387906536955508 14.285714285714285
65 0.002173765042541486 0.002173765042541486 0.0058641581511040776 0.007387906536955508 14.285714285714285
66 0.0005938446829842412 0.0005938446829842412 0.005831533134420141 0.007387906536955508 14.285714285714285
67 0.002009178107907748 0.0005938446829842412 0.004143778769158221 0.007387906536955508 28.57142857142857
68 0.003617978029873307 0.0005938446829842412 0.003617978029873307 0.0069750445812033065 57.14285714285714
69 0.00487874797973096 0.0005938446829842412 0.003617978029873307 0.005831533134420141 85.71428571428571
70 0.005724647981048404 0.0005938446829842412 0.003617978029873307 0.005724647981048404 100
71 0.006133061820877019 0.0005938446829842412 0.003617978029873307 0.006133061820877019 100
72 0.00609960702050407 0.0005938446829842412 0.00487874797973096 0.006133061820877019 85.71428571428571
73 0.005629692701650538 0.002009178107907748 0.005629692701650538 0.006133061820877019 57.14285714285714
74 0.0047386912098765655 0.003617978029873307 0.005629692701650538 0.006133061820877019 28.57142857142857
75 0.0034604186725466744 0.0034604186725466744 0.005629692701650538 0.006133061820877019 14.285714285714285
76 0.0018727317079909123 0.0018727317079909123 0.005629692701650538 0.006133061820877019 14.285714285714285
77 0.0005726849313975644 0.0005726849313975644 0.0047386912098765655 0.006133061820877019 14.285714285714285
78 0.0021237644047560305 0.0005726849313975644 0.0034604186725466744 0.00609960702050407 42.857142857142854
79 0.0039486491976884145 0.0005726849313975644 0.0034604186725466744 0.005629692701650538 71.42857142857143
80 0.005474218145085102 0.0005726849313975644 0.0034604186725466744 0.005474218145085102 100
81 0.006472536350968328 0.0005726849313975644 0.0034604186725466744 0.006472536350968328 100