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
119.93907194735124,112.17793901149825,104.41680607564527
120.2205946444773,112.4485066137704,104.67641858306351
119.4754027890769,111.87506726026072,104.27473173144455
117.92214995997873,110.55350809144618,103.18486622291363
116.0981663662904,108.64654356281615,101.1949207593419
114.09668902536349,106.36918064716815,98.64167226897281
111.94601072115726,103.96951290207254,95.99301508298781
109.71172684641634,101.70655901125973,93.70139117610312
107.62448011894962,99.82712541702527,92.02977071510092
106.14901560252821,98.54375983579114,90.93850406905406
105.42732073595286,98.01576500361824,90.60420927128362
105.60777326921652,98.33496863723775,91.06216400525898
106.8823372030726,99.51752073760144,92.1527042721303
109.25879263933592,101.50245095839546,93.74610927745499
112.39028653227217,104.15711490549148,95.9239432787108
115.87767692583802,107.28904286562594,98.70040880541387
119.3387714067482,110.66313255266266,101.98749369857713
122.70463188879025,114.02265009461973,105.34066830044922
125.72416613266769,117.11216330583574,108.50016047900378
128.21733947341434,119.70035868337361,111.18337789333287
129.90448166017933,121.60070395332828,113.29692624647723
130.56144657807755,122.68811044331473,114.8147743085519
130.46402380747352,122.91010688102654,115.35618995457956
129.72279548299434,122.29152649671846,114.8602575104426
128.32947460477092,120.93228874470736,113.53510288464379
126.34468080273231,118.99847379610331,111.65226678947431
124.05754735139509,116.70748709175275,109.35742683211042
121.68860075837019,114.30863916169584,106.92867756502149
119.36063887262064,112.06087545802716,104.76111204343367
117.27039401335223,110.20964552886487,103.1488970443775
115.79634066529381,108.96497774122763,102.13361481716144
115.37636902515443,108.48271807252614,101.58906711989785
115.89755235353499,108.85060885354945,101.8036653535639
117.15587197033602,110.08045100737432,103.00503004441262
119.28299917725998,112.10704990805283,104.93110063884568
122.23612085548713,114.79403902238239,107.35195718927766
125.88714696890095,117.94606112618295,110.00497528346496
129.79119362357514,121.32621898331006,112.86124434304499
133.48573182025098,124.67723667022013,115.86874152018926
136.58955167841012,127.74444126798842,118.89933085756672
138.9614724382803,130.29851203567645,121.6355516330726
140.45511592930575,132.1559649491455,123.85681396898526
141.2353708402836,133.195542782471,125.1557147246584
141.13492551199874,133.36904665480043,125.60316779760211
140.4077902437067,132.7056414928311,125.00349274195547
139.1749843493039,131.3092508147689,123.44351728023386
137.38231619380932,129.34927355195722,121.31623091010515
135.06526357379713,127.04545214685288,119.02564071990864
132.4840798663955,124.64824361508927,116.81240736378305
130.11369562775693,122.41644696619407,114.71919830463122
128.32320239309632,120.59408545883635,112.86496852457637
127.09431429622603,119.38860872989244,111.68290316355885
126.41052225063177,118.95236193622073,111.49420162180968
126.57904230878574,119.3689772155218,112.15891212225785
127.84716252911065,120.645903076555,113.44464362399935
130.10513930577537,122.71373904603468,115.322338786294
133.06172701847464,125.43243500621655,117.80314299395847
136.43824578727498,128.6038014548115,120.76935712234804
140.07408283331483,131.98921318296692,123.90434353261902
143.58125461055812,135.33092495448764,127.08059529841717
146.58783239206124,138.3750951201553,130.16235784824934
148.92153673829222,140.89446053624863,132.86738433420504
150.53381568587045,142.70863730432555,134.88345892278065
151.5279478334936,143.70023392764224,135.87252002179088
151.63693370833758,143.82533754393614,136.0137413795347
150.70554925591327,143.11743653062805,135.52932380534284
149.08246204055595,141.68442908780412,134.28639613505229
147.22185682095676,139.6989850133501,132.17611320574343
145.18806129312355,137.3831216241601,129.57818195519667
143.0133130903648,134.98837161044193,126.96343013051906
140.77214285815816,132.77331436962828,124.77448588109841
138.74212341391828,130.98047787891855,123.21883234391882
137.38068342076662,129.81467439338476,122.2486653660029
136.8174645230218,129.42470517720838,122.03194583139495
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 119.93907194735124 112.17793901149825 104.41680607564527
9 120.2205946444773 112.4485066137704 104.67641858306351
10 119.4754027890769 111.87506726026072 104.27473173144455
11 117.92214995997873 110.55350809144618 103.18486622291363
12 116.0981663662904 108.64654356281615 101.1949207593419
13 114.09668902536349 106.36918064716815 98.64167226897281
14 111.94601072115726 103.96951290207254 95.99301508298781
15 109.71172684641634 101.70655901125973 93.70139117610312
16 107.62448011894962 99.82712541702527 92.02977071510092
17 106.14901560252821 98.54375983579114 90.93850406905406
18 105.42732073595286 98.01576500361824 90.60420927128362
19 105.60777326921652 98.33496863723775 91.06216400525898
20 106.8823372030726 99.51752073760144 92.1527042721303
21 109.25879263933592 101.50245095839546 93.74610927745499
22 112.39028653227217 104.15711490549148 95.9239432787108
23 115.87767692583802 107.28904286562594 98.70040880541387
24 119.3387714067482 110.66313255266266 101.98749369857713
25 122.70463188879025 114.02265009461973 105.34066830044922
26 125.72416613266769 117.11216330583574 108.50016047900378
27 128.21733947341434 119.70035868337361 111.18337789333287
28 129.90448166017933 121.60070395332828 113.29692624647723
29 130.56144657807755 122.68811044331473 114.8147743085519
30 130.46402380747352 122.91010688102654 115.35618995457956
31 129.72279548299434 122.29152649671846 114.8602575104426
32 128.32947460477092 120.93228874470736 113.53510288464379
33 126.34468080273231 118.99847379610331 111.65226678947431
34 124.05754735139509 116.70748709175275 109.35742683211042
35 121.68860075837019 114.30863916169584 106.92867756502149
36 119.36063887262064 112.06087545802716 104.76111204343367
37 117.27039401335223 110.20964552886487 103.1488970443775
38 115.79634066529381 108.96497774122763 102.13361481716144
39 115.37636902515443 108.48271807252614 101.58906711989785
40 115.89755235353499 108.85060885354945 101.8036653535639
41 117.15587197033602 110.08045100737432 103.00503004441262
42 119.28299917725998 112.10704990805283 104.93110063884568
43 122.23612085548713 114.79403902238239 107.35195718927766
44 125.88714696890095 117.94606112618295 110.00497528346496
45 129.79119362357514 121.32621898331006 112.86124434304499
46 133.48573182025098 124.67723667022013 115.86874152018926
47 136.58955167841012 127.74444126798842 118.89933085756672
48 138.9614724382803 130.29851203567645 121.6355516330726
49 140.45511592930575 132.1559649491455 123.85681396898526
50 141.2353708402836 133.195542782471 125.1557147246584
51 141.13492551199874 133.36904665480043 125.60316779760211
52 140.4077902437067 132.7056414928311 125.00349274195547
53 139.1749843493039 131.3092508147689 123.44351728023386
54 137.38231619380932 129.34927355195722 121.31623091010515
55 135.06526357379713 127.04545214685288 119.02564071990864
56 132.4840798663955 124.64824361508927 116.81240736378305
57 130.11369562775693 122.41644696619407 114.71919830463122
58 128.32320239309632 120.59408545883635 112.86496852457637
59 127.09431429622603 119.38860872989244 111.68290316355885
60 126.41052225063177 118.95236193622073 111.49420162180968
61 126.57904230878574 119.3689772155218 112.15891212225785
62 127.84716252911065 120.645903076555 113.44464362399935
63 130.10513930577537 122.71373904603468 115.322338786294
64 133.06172701847464 125.43243500621655 117.80314299395847
65 136.43824578727498 128.6038014548115 120.76935712234804
66 140.07408283331483 131.98921318296692 123.90434353261902
67 143.58125461055812 135.33092495448764 127.08059529841717
68 146.58783239206124 138.3750951201553 130.16235784824934
69 148.92153673829222 140.89446053624863 132.86738433420504
70 150.53381568587045 142.70863730432555 134.88345892278065
71 151.5279478334936 143.70023392764224 135.87252002179088
72 151.63693370833758 143.82533754393614 136.0137413795347
73 150.70554925591327 143.11743653062805 135.52932380534284
74 149.08246204055595 141.68442908780412 134.28639613505229
75 147.22185682095676 139.6989850133501 132.17611320574343
76 145.18806129312355 137.3831216241601 129.57818195519667
77 143.0133130903648 134.98837161044193 126.96343013051906
78 140.77214285815816 132.77331436962828 124.77448588109841
79 138.74212341391828 130.98047787891855 123.21883234391882
80 137.38068342076662 129.81467439338476 122.2486653660029
81 136.8174645230218 129.42470517720838 122.03194583139495