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 @@
upper,middle,lower
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
142.43897548923832,107.082865308575,71.72675512791169
144.59462365481113,106.96031118542241,69.32599871603371
145.0030716573113,106.55098952518925,68.0989073930672
144.3882094557178,105.93612732359576,67.4840451914737
143.66739403289267,105.21531190077062,66.76322976864856
142.9496771946618,104.49759506253974,66.04551293041769
142.34383395951772,103.89175182739567,65.43966969527361
140.73968594718195,103.49656387805487,66.25344180892779
136.96338192750358,103.39199568793734,69.8206094483711
142.28956590886727,103.63205153291037,64.97453715695346
149.3143869040551,104.23995145016349,59.165515996271864
156.09055012094973,105.20605706144154,54.32156400193334
161.34792683057526,106.48873254066868,51.629538250762096
164.71733229713175,108.01806381828972,51.318795339447675
166.40137227572393,109.7021037968819,53.00283531803986
168.13435419036813,111.4350857115261,54.735817232684056
168.58504059568355,113.10687095991703,57.6287013241505
167.32291794437685,114.61278745568676,61.90265696699667
163.92759220237946,115.86297967414018,67.7983671459009
160.04941552271148,116.79043517866376,73.53145483461603
154.51158769168006,117.35697064210828,80.2023535925365
149.10163457719665,117.55664264968355,86.01165072217044
151.61613099212053,117.41627860650068,83.21642622088085
152.5753461456141,116.99308032537222,81.41081450513035
152.40948030896186,116.36951435923494,80.32954840950804
151.68591145930912,115.64594550958222,79.60597955985531
150.971637487385,114.93167153765809,78.89170558793118
150.2476450454987,114.33515992096163,78.42267479642457
149.19256677818754,113.9543587765253,78.71615077486304
148.00268774024445,113.86794744733447,79.73320715442449
155.87334290074438,114.12830831094557,72.38327372114675
162.6402208289146,114.75684761770661,66.87347440649863
168.11262182090675,115.742083334167,63.37154484742726
173.15068590548697,117.04067079892921,60.930655692371474
176.15178108369062,118.58127457216008,61.010768060629545
177.8661286233169,120.2709406179764,62.67575261263589
179.59858761697018,122.00339961162967,64.40821160628917
181.2637476671299,123.66855966178939,66.07337165644888
180.6518868003708,125.16234049131411,69.67279418225742
177.18552192254725,126.39597061843133,75.60641931431542
171.25336710627585,127.30391704882051,83.35446699136519
164.6582243048905,127.84973914282192,91.04125398075332
160.1139469749142,128.0293437492481,95.94474052358203
162.75117071043894,127.87135083438908,92.9915309583392
163.05473223647277,127.43453694566097,91.81434165484916
162.4227801684886,126.80258487767678,91.18238958686497
161.69680382824373,126.07660853743191,90.4564132466201
160.98631603094674,125.36612074013492,89.74592544932311
160.3994460463934,124.7792507555816,89.15905546476979
158.0719779035228,124.41308544252024,90.75419298151769
155.96015529297182,124.34499676870873,92.72983824444562
163.7108792225584,124.62573040346784,85.5405815843773
170.8735345302779,125.27487275817427,79.67621098607063
176.8663552570761,126.27910139046546,75.69184752385482
182.2692330966496,127.59337505833837,72.91751702002715
186.7855546323677,129.14495712015346,71.50435960793922
189.4720506308403,130.83991288220435,72.20777513356839
191.20363825378143,132.57150050514548,73.93936275650952
191.4641446590945,134.2297059345968,76.99526721009912
190.5489000989824,135.71107012897224,80.87324015896209
188.31556437399772,136.92793074753726,85.5402971210768
184.58207271426198,137.81625276622648,91.05043281819098
178.80311469886897,138.34134853563094,97.87958237239292
174.22948135812942,138.50097632541122,102.77247129269301
176.23749538789545,138.3255405713923,100.41358575488917
176.2192892668097,137.87537593786334,99.53146260891697
175.5792711306549,137.23535780170852,98.89144447276215
1 upper middle lower
2 nan nan nan
3 nan nan nan
4 nan nan nan
5 nan nan nan
6 nan nan nan
7 nan nan nan
8 nan nan nan
9 nan nan nan
10 nan nan nan
11 nan nan nan
12 nan nan nan
13 nan nan nan
14 nan nan nan
15 142.43897548923832 107.082865308575 71.72675512791169
16 144.59462365481113 106.96031118542241 69.32599871603371
17 145.0030716573113 106.55098952518925 68.0989073930672
18 144.3882094557178 105.93612732359576 67.4840451914737
19 143.66739403289267 105.21531190077062 66.76322976864856
20 142.9496771946618 104.49759506253974 66.04551293041769
21 142.34383395951772 103.89175182739567 65.43966969527361
22 140.73968594718195 103.49656387805487 66.25344180892779
23 136.96338192750358 103.39199568793734 69.8206094483711
24 142.28956590886727 103.63205153291037 64.97453715695346
25 149.3143869040551 104.23995145016349 59.165515996271864
26 156.09055012094973 105.20605706144154 54.32156400193334
27 161.34792683057526 106.48873254066868 51.629538250762096
28 164.71733229713175 108.01806381828972 51.318795339447675
29 166.40137227572393 109.7021037968819 53.00283531803986
30 168.13435419036813 111.4350857115261 54.735817232684056
31 168.58504059568355 113.10687095991703 57.6287013241505
32 167.32291794437685 114.61278745568676 61.90265696699667
33 163.92759220237946 115.86297967414018 67.7983671459009
34 160.04941552271148 116.79043517866376 73.53145483461603
35 154.51158769168006 117.35697064210828 80.2023535925365
36 149.10163457719665 117.55664264968355 86.01165072217044
37 151.61613099212053 117.41627860650068 83.21642622088085
38 152.5753461456141 116.99308032537222 81.41081450513035
39 152.40948030896186 116.36951435923494 80.32954840950804
40 151.68591145930912 115.64594550958222 79.60597955985531
41 150.971637487385 114.93167153765809 78.89170558793118
42 150.2476450454987 114.33515992096163 78.42267479642457
43 149.19256677818754 113.9543587765253 78.71615077486304
44 148.00268774024445 113.86794744733447 79.73320715442449
45 155.87334290074438 114.12830831094557 72.38327372114675
46 162.6402208289146 114.75684761770661 66.87347440649863
47 168.11262182090675 115.742083334167 63.37154484742726
48 173.15068590548697 117.04067079892921 60.930655692371474
49 176.15178108369062 118.58127457216008 61.010768060629545
50 177.8661286233169 120.2709406179764 62.67575261263589
51 179.59858761697018 122.00339961162967 64.40821160628917
52 181.2637476671299 123.66855966178939 66.07337165644888
53 180.6518868003708 125.16234049131411 69.67279418225742
54 177.18552192254725 126.39597061843133 75.60641931431542
55 171.25336710627585 127.30391704882051 83.35446699136519
56 164.6582243048905 127.84973914282192 91.04125398075332
57 160.1139469749142 128.0293437492481 95.94474052358203
58 162.75117071043894 127.87135083438908 92.9915309583392
59 163.05473223647277 127.43453694566097 91.81434165484916
60 162.4227801684886 126.80258487767678 91.18238958686497
61 161.69680382824373 126.07660853743191 90.4564132466201
62 160.98631603094674 125.36612074013492 89.74592544932311
63 160.3994460463934 124.7792507555816 89.15905546476979
64 158.0719779035228 124.41308544252024 90.75419298151769
65 155.96015529297182 124.34499676870873 92.72983824444562
66 163.7108792225584 124.62573040346784 85.5405815843773
67 170.8735345302779 125.27487275817427 79.67621098607063
68 176.8663552570761 126.27910139046546 75.69184752385482
69 182.2692330966496 127.59337505833837 72.91751702002715
70 186.7855546323677 129.14495712015346 71.50435960793922
71 189.4720506308403 130.83991288220435 72.20777513356839
72 191.20363825378143 132.57150050514548 73.93936275650952
73 191.4641446590945 134.2297059345968 76.99526721009912
74 190.5489000989824 135.71107012897224 80.87324015896209
75 188.31556437399772 136.92793074753726 85.5402971210768
76 184.58207271426198 137.81625276622648 91.05043281819098
77 178.80311469886897 138.34134853563094 97.87958237239292
78 174.22948135812942 138.50097632541122 102.77247129269301
79 176.23749538789545 138.3255405713923 100.41358575488917
80 176.2192892668097 137.87537593786334 99.53146260891697
81 175.5792711306549 137.23535780170852 98.89144447276215