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 @@
middle,upper,lower,percent_b
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,nan,nan,nan
nan,nan,nan,nan
0.10068092037709826,1.5671856354506895,-1.365823794696493,0.798637534659061
0.0831025099730484,1.5114705672495936,-1.3452655473034967,0.7348133385344883
0.04517770682623734,1.414112484869872,-1.3237570712173974,0.6101066376002235
-0.003808174579245157,1.3395940620678024,-1.3472104112262926,0.4472637995664592
-0.05186168203299652,1.3251450329727406,-1.4288683970387335,0.30023691436772204
-0.08721764098567775,1.3495102317416487,-1.5239455137130042,0.21326768397171267
-0.10121967960349565,1.3665518629888116,-1.568991222195803,0.19479157668825592
-0.0904396104946384,1.3530796849804743,-1.533958905969751,0.24069209849550027
-0.05751677054500907,1.327143900592509,-1.442177441682527,0.3490532134824155
-0.010511819198460972,1.334110830055587,-1.355134468452509,0.5055545387379881
0.03906679210038127,1.40156070708023,-1.3234271228794674,0.6630238351043192
0.0790804901910432,1.4996240453017373,-1.341463064919651,0.769183393142021
0.09973252625442289,1.56402100180651,-1.3645559492976642,0.8066560202850594
0.09596656159726738,1.5516297106607913,-1.3596965874662565,0.7787321436195506
0.06870463571025757,1.470682827203311,-1.3332735557827957,0.6876691202447431
0.024621418843437937,1.375528628150024,-1.3262857904631482,0.5414964842115016
-0.025489980058256582,1.3259676301524586,-1.3769475902689718,0.3781188976104552
-0.06936054284755702,1.333720890111726,-1.4724419758068399,0.2539959713687912
-0.09624922571427622,1.3600515403737479,-1.5525499918023002,0.19710781672029587
-0.09957274131704098,1.364344079859441,-1.5634895624935232,0.20692093751722165
-0.0785173771246355,1.340958326604157,-1.4979930808534279,0.28024291689557795
-0.038238220622860454,1.323452191725603,-1.3999286329713239,0.4130033099740635
0.011402985891957127,1.3562737839731638,-1.3334678121892496,0.5773445960817635
0.05825234376738767,1.4439634439615052,-1.32745875642673,0.7172402185391868
0.0908394962670483,1.5352165961128448,-1.3535376035787483,0.7937894119104404
0.10118597194234676,1.5688780888981149,-1.3665061450134215,0.802351779365411
0.08675859270201565,1.522536356146082,-1.349019170742051,0.746924139363701
0.05108968415652981,1.427109838196745,-1.3249304698836855,0.629719167487726
0.002912239114498862,1.3462378922614895,-1.3404134140324917,0.46930163352429666
-0.04597822363065112,1.3238670637034846,-1.415823510964787,0.31685850174727315
-0.08361161368441015,1.3457713837148857,-1.5129946110837058,0.22079557567524843
-0.10077396465125434,1.365949127887157,-1.5674970571896658,0.19347081725317605
-0.09326333445658516,1.3563830081014534,-1.5429096770146238,0.23095461881396528
-0.06291858731444222,1.3297469324678208,-1.4555841070967053,0.33128955720379594
-0.017169175635278373,1.3297931810907817,-1.3641315323613383,0.4833937013400019
0.03278384903533497,1.3896046638046249,-1.324036965733955,0.6442324417643185
0.074710244085391,1.4871464523940374,-1.3377259642232553,0.7590202819506588
0.09834496577249041,1.5594227913962826,-1.3627328598513018,0.8055476684514689
0.09790140993789517,1.5579609159108678,-1.3621580960350774,0.7860889226461063
0.07348817451946436,1.4837317594413215,-1.3367554104023927,0.7033092559116134
0.031082470988981266,1.3865342161004732,-1.3243692741225108,0.5630980224914359
-0.018933305478677807,1.3288367289840555,-1.366703339941411,0.3986453563036554
-0.0643135484430439,1.3305278222388335,-1.4591549191249213,0.26679304399374637
-0.09394759173513632,1.3572078532635294,-1.545103036733802,0.20070116279678463
-0.10057998803366022,1.365688027434422,-1.5668480035017425,0.2019421829889777
-0.08258689541182918,1.3447588311864465,-1.5099326220101048,0.26688526757173203
-0.04437365047450977,1.3236620965062358,-1.4124093974552554,0.3925665644537145
0.004703811684130699,1.348203009404551,-1.3387953860362896,0.555656020657547
0.05262961669132896,1.4306316627864566,-1.3253724294037987,0.7018960570457022
0.0876698560104389,1.5253379786657377,-1.3499982666448598,0.787643750584985
0.101245456985074,1.569077753981039,-1.366586840010891,0.8049471156903286
0.0900326390310054,1.532682295927599,-1.3526170178655883,0.757924963943221
0.05677669104408726,1.4403931798265126,-1.3268397977383382,0.6485076076119257
0.009619828933252401,1.3540142695689665,-1.334774611702462,0.49148442768572037
-0.03989230280370545,1.3234187893805462,-1.4032033949879572,0.3345416450754039
-0.07963740752161742,1.3419689580261547,-1.5012437730693897,0.22955492958604468
-0.09988449742655092,1.364757923158418,-1.5645269180115198,0.193282907351767
-0.09567637876783307,1.3593338544322902,-1.550686611967956,0.22233328402558783
-0.06804334575638446,1.3328322950662468,-1.4689189865790158,0.3144947871679775
-0.023750928609126327,1.3266235872621852,-1.374125444480438,0.46141338577060437
0.026356544204238577,1.3783820687835984,-1.3256689803751212,0.6245645359826373
0.07001101577979389,1.4741960340436686,-1.3341740024840807,0.7476180229530415
0.09652434897291837,1.553447253643897,-1.3603985556980602,0.8032824485784161
0.09940515513311661,1.562932715615541,-1.364122405349308,0.7923308422808695
0.07794811244074294,1.4963512474827365,-1.3404550226012508,0.717893341516359
0.037406653287415485,1.3983075138230079,-1.3234942072481768,0.5842222551693794
-0.012293259193311559,1.3328455391454017,-1.357432057532025,0.41979501462738084
1 middle upper lower percent_b
2 nan nan nan nan
3 nan nan nan nan
4 nan nan nan nan
5 nan nan nan nan
6 nan nan nan nan
7 nan nan nan nan
8 nan nan nan nan
9 nan nan nan nan
10 nan nan nan nan
11 nan nan nan nan
12 nan nan nan nan
13 nan nan nan nan
14 nan nan nan nan
15 0.10068092037709826 1.5671856354506895 -1.365823794696493 0.798637534659061
16 0.0831025099730484 1.5114705672495936 -1.3452655473034967 0.7348133385344883
17 0.04517770682623734 1.414112484869872 -1.3237570712173974 0.6101066376002235
18 -0.003808174579245157 1.3395940620678024 -1.3472104112262926 0.4472637995664592
19 -0.05186168203299652 1.3251450329727406 -1.4288683970387335 0.30023691436772204
20 -0.08721764098567775 1.3495102317416487 -1.5239455137130042 0.21326768397171267
21 -0.10121967960349565 1.3665518629888116 -1.568991222195803 0.19479157668825592
22 -0.0904396104946384 1.3530796849804743 -1.533958905969751 0.24069209849550027
23 -0.05751677054500907 1.327143900592509 -1.442177441682527 0.3490532134824155
24 -0.010511819198460972 1.334110830055587 -1.355134468452509 0.5055545387379881
25 0.03906679210038127 1.40156070708023 -1.3234271228794674 0.6630238351043192
26 0.0790804901910432 1.4996240453017373 -1.341463064919651 0.769183393142021
27 0.09973252625442289 1.56402100180651 -1.3645559492976642 0.8066560202850594
28 0.09596656159726738 1.5516297106607913 -1.3596965874662565 0.7787321436195506
29 0.06870463571025757 1.470682827203311 -1.3332735557827957 0.6876691202447431
30 0.024621418843437937 1.375528628150024 -1.3262857904631482 0.5414964842115016
31 -0.025489980058256582 1.3259676301524586 -1.3769475902689718 0.3781188976104552
32 -0.06936054284755702 1.333720890111726 -1.4724419758068399 0.2539959713687912
33 -0.09624922571427622 1.3600515403737479 -1.5525499918023002 0.19710781672029587
34 -0.09957274131704098 1.364344079859441 -1.5634895624935232 0.20692093751722165
35 -0.0785173771246355 1.340958326604157 -1.4979930808534279 0.28024291689557795
36 -0.038238220622860454 1.323452191725603 -1.3999286329713239 0.4130033099740635
37 0.011402985891957127 1.3562737839731638 -1.3334678121892496 0.5773445960817635
38 0.05825234376738767 1.4439634439615052 -1.32745875642673 0.7172402185391868
39 0.0908394962670483 1.5352165961128448 -1.3535376035787483 0.7937894119104404
40 0.10118597194234676 1.5688780888981149 -1.3665061450134215 0.802351779365411
41 0.08675859270201565 1.522536356146082 -1.349019170742051 0.746924139363701
42 0.05108968415652981 1.427109838196745 -1.3249304698836855 0.629719167487726
43 0.002912239114498862 1.3462378922614895 -1.3404134140324917 0.46930163352429666
44 -0.04597822363065112 1.3238670637034846 -1.415823510964787 0.31685850174727315
45 -0.08361161368441015 1.3457713837148857 -1.5129946110837058 0.22079557567524843
46 -0.10077396465125434 1.365949127887157 -1.5674970571896658 0.19347081725317605
47 -0.09326333445658516 1.3563830081014534 -1.5429096770146238 0.23095461881396528
48 -0.06291858731444222 1.3297469324678208 -1.4555841070967053 0.33128955720379594
49 -0.017169175635278373 1.3297931810907817 -1.3641315323613383 0.4833937013400019
50 0.03278384903533497 1.3896046638046249 -1.324036965733955 0.6442324417643185
51 0.074710244085391 1.4871464523940374 -1.3377259642232553 0.7590202819506588
52 0.09834496577249041 1.5594227913962826 -1.3627328598513018 0.8055476684514689
53 0.09790140993789517 1.5579609159108678 -1.3621580960350774 0.7860889226461063
54 0.07348817451946436 1.4837317594413215 -1.3367554104023927 0.7033092559116134
55 0.031082470988981266 1.3865342161004732 -1.3243692741225108 0.5630980224914359
56 -0.018933305478677807 1.3288367289840555 -1.366703339941411 0.3986453563036554
57 -0.0643135484430439 1.3305278222388335 -1.4591549191249213 0.26679304399374637
58 -0.09394759173513632 1.3572078532635294 -1.545103036733802 0.20070116279678463
59 -0.10057998803366022 1.365688027434422 -1.5668480035017425 0.2019421829889777
60 -0.08258689541182918 1.3447588311864465 -1.5099326220101048 0.26688526757173203
61 -0.04437365047450977 1.3236620965062358 -1.4124093974552554 0.3925665644537145
62 0.004703811684130699 1.348203009404551 -1.3387953860362896 0.555656020657547
63 0.05262961669132896 1.4306316627864566 -1.3253724294037987 0.7018960570457022
64 0.0876698560104389 1.5253379786657377 -1.3499982666448598 0.787643750584985
65 0.101245456985074 1.569077753981039 -1.366586840010891 0.8049471156903286
66 0.0900326390310054 1.532682295927599 -1.3526170178655883 0.757924963943221
67 0.05677669104408726 1.4403931798265126 -1.3268397977383382 0.6485076076119257
68 0.009619828933252401 1.3540142695689665 -1.334774611702462 0.49148442768572037
69 -0.03989230280370545 1.3234187893805462 -1.4032033949879572 0.3345416450754039
70 -0.07963740752161742 1.3419689580261547 -1.5012437730693897 0.22955492958604468
71 -0.09988449742655092 1.364757923158418 -1.5645269180115198 0.193282907351767
72 -0.09567637876783307 1.3593338544322902 -1.550686611967956 0.22233328402558783
73 -0.06804334575638446 1.3328322950662468 -1.4689189865790158 0.3144947871679775
74 -0.023750928609126327 1.3266235872621852 -1.374125444480438 0.46141338577060437
75 0.026356544204238577 1.3783820687835984 -1.3256689803751212 0.6245645359826373
76 0.07001101577979389 1.4741960340436686 -1.3341740024840807 0.7476180229530415
77 0.09652434897291837 1.553447253643897 -1.3603985556980602 0.8032824485784161
78 0.09940515513311661 1.562932715615541 -1.364122405349308 0.7923308422808695
79 0.07794811244074294 1.4963512474827365 -1.3404550226012508 0.717893341516359
80 0.037406653287415485 1.3983075138230079 -1.3234942072481768 0.5842222551693794
81 -0.012293259193311559 1.3328455391454017 -1.357432057532025 0.41979501462738084