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 @@
st1,st2
nan,nan
nan,nan
nan,nan
nan,nan
nan,nan
nan,nan
112.54581950294732,107.97543476728107
112.90310541367676,109.84690934015738
112.30508272771986,110.99905831591097
110.85365744271037,111.35661876177348
108.74333976862135,110.92397140354863
106.23892462044755,109.78679195975951
103.64409586100508,108.1038189240327
101.26565439681481,106.08961492949184
99.37868205590502,103.99061052071445
98.19757230280675,102.05774302764134
97.85659208055664,100.51944405999737
98.40178140701418,99.55851408002566
99.79396110399783,99.29561580630573
101.92083667852313,99.78090441036225
104.61501056335108,100.99395243711264
107.67433963450408,102.85089762570536
110.8814963458434,105.21687185737797
114.0206178398289,107.92139204822932
116.8902325699235,110.77451955266649
119.31286585059627,113.58211674877728
121.14252078343476,116.15925666462002
122.27141615599164,118.34155052094101
122.63692277053191,119.99465237850349
122.22873756093031,121.0223600425144
121.09526790494733,121.37354340599177
119.34731806984773,121.04768902132817
117.15678723441961,120.09832634986729
114.74839082847001,118.63320199672118
112.38341210400677,116.80997299904898
110.33599893425533,114.82650184860593
108.86421218566029,112.90554826446262
108.1795044783255,111.27464581621106
108.4191844835196,110.14301602589389
109.6264435937495,109.67825813274685
111.74161629975049,109.98602816104554
114.6066501116576,111.09583231488709
117.98259625379787,112.95537126969366
121.57773307581742,115.43467997111289
125.0821503059135,118.33982338385339
128.20361746699334,121.43441397689669
130.6995284501467,124.46600205242598
132.40063877488237,127.1936901589099
133.22396933363612,129.41326507203033
133.17426612025795,130.97671770948028
132.33534294064563,131.8040943866934
130.85409624512894,131.88695618883693
128.9207006775812,131.28403908544652
126.74839055438959,130.11074957422608
124.55542434275895,128.52472143221263
122.55059540904846,126.70973597490897
120.9223573994742,124.85993155103303
119.8306317483614,123.16555949266224
119.39991338150791,121.80080046192852
119.71248088491855,120.91355163989189
120.80125729168374,120.61678809435973
122.64290767686418,120.98115046225932
125.15276004225012,122.02876505412118
128.1837570812335,123.72881652939944
131.5316409119889,125.99586867524256
134.94785443643588,128.69216836337606
138.16031537790022,131.63503131210587
140.90055714139967,134.6098543251208
142.9341175953152,137.38840118556934
144.0898924653362,139.7509452077142
144.28377232849027,141.50986085965945
143.53240673831147,142.53158653970758
141.95433553918397,142.75372282317767
139.75774519581202,142.19447363876452
137.2163489957044,140.95264019155246
134.63689792691332,139.19777153671973
132.3231926468278,137.15160228797524
130.54191361313164,135.0632721706845
129.49504341233953,133.18175868273178
129.30226429258488,131.72928603943276
1 st1 st2
2 nan nan
3 nan nan
4 nan nan
5 nan nan
6 nan nan
7 nan nan
8 112.54581950294732 107.97543476728107
9 112.90310541367676 109.84690934015738
10 112.30508272771986 110.99905831591097
11 110.85365744271037 111.35661876177348
12 108.74333976862135 110.92397140354863
13 106.23892462044755 109.78679195975951
14 103.64409586100508 108.1038189240327
15 101.26565439681481 106.08961492949184
16 99.37868205590502 103.99061052071445
17 98.19757230280675 102.05774302764134
18 97.85659208055664 100.51944405999737
19 98.40178140701418 99.55851408002566
20 99.79396110399783 99.29561580630573
21 101.92083667852313 99.78090441036225
22 104.61501056335108 100.99395243711264
23 107.67433963450408 102.85089762570536
24 110.8814963458434 105.21687185737797
25 114.0206178398289 107.92139204822932
26 116.8902325699235 110.77451955266649
27 119.31286585059627 113.58211674877728
28 121.14252078343476 116.15925666462002
29 122.27141615599164 118.34155052094101
30 122.63692277053191 119.99465237850349
31 122.22873756093031 121.0223600425144
32 121.09526790494733 121.37354340599177
33 119.34731806984773 121.04768902132817
34 117.15678723441961 120.09832634986729
35 114.74839082847001 118.63320199672118
36 112.38341210400677 116.80997299904898
37 110.33599893425533 114.82650184860593
38 108.86421218566029 112.90554826446262
39 108.1795044783255 111.27464581621106
40 108.4191844835196 110.14301602589389
41 109.6264435937495 109.67825813274685
42 111.74161629975049 109.98602816104554
43 114.6066501116576 111.09583231488709
44 117.98259625379787 112.95537126969366
45 121.57773307581742 115.43467997111289
46 125.0821503059135 118.33982338385339
47 128.20361746699334 121.43441397689669
48 130.6995284501467 124.46600205242598
49 132.40063877488237 127.1936901589099
50 133.22396933363612 129.41326507203033
51 133.17426612025795 130.97671770948028
52 132.33534294064563 131.8040943866934
53 130.85409624512894 131.88695618883693
54 128.9207006775812 131.28403908544652
55 126.74839055438959 130.11074957422608
56 124.55542434275895 128.52472143221263
57 122.55059540904846 126.70973597490897
58 120.9223573994742 124.85993155103303
59 119.8306317483614 123.16555949266224
60 119.39991338150791 121.80080046192852
61 119.71248088491855 120.91355163989189
62 120.80125729168374 120.61678809435973
63 122.64290767686418 120.98115046225932
64 125.15276004225012 122.02876505412118
65 128.1837570812335 123.72881652939944
66 131.5316409119889 125.99586867524256
67 134.94785443643588 128.69216836337606
68 138.16031537790022 131.63503131210587
69 140.90055714139967 134.6098543251208
70 142.9341175953152 137.38840118556934
71 144.0898924653362 139.7509452077142
72 144.28377232849027 141.50986085965945
73 143.53240673831147 142.53158653970758
74 141.95433553918397 142.75372282317767
75 139.75774519581202 142.19447363876452
76 137.2163489957044 140.95264019155246
77 134.63689792691332 139.19777153671973
78 132.3231926468278 137.15160228797524
79 130.54191361313164 135.0632721706845
80 129.49504341233953 133.18175868273178
81 129.30226429258488 131.72928603943276