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 @@
ratio,ratio_ma,ratio_rsi
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
1.0077299254178438,1.001101527902105,47.00474897115976
1.003559685881568,1.0007446981455275,42.21484268569747
0.9985180859381477,1.0002751261704002,37.27015827002299
0.9939704667662251,0.9997982019505665,33.46270297105181
0.9910833902519574,0.9994273268055605,31.278098549084703
0.990502246423747,0.9992540934263401,30.841623878463228
0.9922340489872953,0.9993211596714497,33.806022560339
0.9957214216283135,0.9996071328594045,39.43581475626989
1.0000387841527627,1.0000289818095953,45.603850610987585
1.0041378444911326,1.0004626978291067,50.733986928910205
1.00708568262615,1.0007779007008082,54.087468988024625
1.0082543026755924,1.0008770628798267,55.38403097018546
1.0074333367234023,1.0007263691546702,54.225514464073825
1.0048523765354684,1.0003658284642574,50.63922332414034
1.0011170497011226,0.9998934801987772,45.90712318928487
0.997078442713023,0.999430534258167,41.40228806381883
0.9936629764587528,0.9990837407239245,38.00564422337914
0.9916885104698924,0.998920743845615,36.158825271795315
0.9916880220738206,0.9989639318328909,36.15835722195286
0.9937635130140252,0.9991968794464823,39.72879157857047
0.9975047852761326,0.9995733606099707,45.63145310471504
1.002022793844247,1.0000234586253944,51.773788755202204
1.0061407489734806,1.0004593132554458,56.58789735962104
1.0087304310462555,1.0007873551522404,59.33694500506314
1.009085854603015,1.0009302245791594,59.714004591000744
1.0071640602443972,1.0008523501197881,56.65490987131541
1.003572578812704,1.0005765816975956,51.359617958814646
0.9993254309005892,1.0001817998665328,45.896502386420586
0.9955061415675478,0.9997810207141345,41.61015116250623
0.9929825239913758,0.9994884550911597,39.017224670765955
0.992243597361587,0.9993870708699335,38.265326899884144
0.9933544098246885,0.9995060636809904,40.133054899144334
0.9959928264797866,0.999813549709988,44.43323743045732
0.9995364808927122,1.0002259045584656,49.662976161858325
1.0031837526854632,1.0006315450877035,54.41806966080533
1.0061021795899932,1.0009229297838282,57.84924023988153
1.0075947443581947,1.001026786597022,59.527201315188215
1.007261226244084,1.0009218433968667,58.96236540907548
1.005116793199719,1.000638339010917,55.327207110391086
1.0016250204350823,1.0002426933102517,49.929337394341594
0.9976165148984415,0.9998172601735186,44.555260949615615
0.9940965773656751,0.9994437706353104,40.43914883953237
0.9919840916744096,0.9991921956429434,38.160656641948364
0.9918531076899305,0.999111523049983,38.01762253824275
0.9937568987522472,0.9992196160064587,41.452549579003154
0.9971973140661597,0.9994941091665639,47.152250363023654
1.0012608848264895,0.9998703990484712,52.97531490233398
1.0048854290532758,1.0002524667742259,57.47610165041397
1.007167955358867,1.000537052679469,60.06807122484348
1.007606174744058,1.0006444809047594,60.56505085696511
1.0061978455976288,1.0005447024218619,58.064000021934916
1.0033872093786016,1.0002679869314701,53.330711631168185
0.999905938746761,0.9998957830419731,48.1004546511982
0.9965777326437868,0.9995352624854521,43.689064180203566
0.9941415893444104,0.9992870535173071,40.74354133683618
0.9931200668599705,0.9992173027668997,39.53974424051918
0.9937361152841923,0.9993424473104557,40.678056703575464
0.9958741083421865,0.9996296616427597,44.57792898526234
0.9990855848140147,1.000010282075743,49.90526661382926
1.0026500784819516,1.0003997652482997,55.06780072153848
1.0057051809905053,1.0007172149743007,58.97061999832174
1.0074459357507306,1.0009001083098332,61.04677907809826
1.007357474771272,1.0009136454107193,60.87819123715923
1.0054020814723927,1.0007562101770289,57.12292288138808
1.0020691777024513,1.0004613053273732,51.31288450153303
0.9982432499438905,1.0000938796534653,45.581543117736
1 ratio ratio_ma ratio_rsi
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 nan nan nan
16 1.0077299254178438 1.001101527902105 47.00474897115976
17 1.003559685881568 1.0007446981455275 42.21484268569747
18 0.9985180859381477 1.0002751261704002 37.27015827002299
19 0.9939704667662251 0.9997982019505665 33.46270297105181
20 0.9910833902519574 0.9994273268055605 31.278098549084703
21 0.990502246423747 0.9992540934263401 30.841623878463228
22 0.9922340489872953 0.9993211596714497 33.806022560339
23 0.9957214216283135 0.9996071328594045 39.43581475626989
24 1.0000387841527627 1.0000289818095953 45.603850610987585
25 1.0041378444911326 1.0004626978291067 50.733986928910205
26 1.00708568262615 1.0007779007008082 54.087468988024625
27 1.0082543026755924 1.0008770628798267 55.38403097018546
28 1.0074333367234023 1.0007263691546702 54.225514464073825
29 1.0048523765354684 1.0003658284642574 50.63922332414034
30 1.0011170497011226 0.9998934801987772 45.90712318928487
31 0.997078442713023 0.999430534258167 41.40228806381883
32 0.9936629764587528 0.9990837407239245 38.00564422337914
33 0.9916885104698924 0.998920743845615 36.158825271795315
34 0.9916880220738206 0.9989639318328909 36.15835722195286
35 0.9937635130140252 0.9991968794464823 39.72879157857047
36 0.9975047852761326 0.9995733606099707 45.63145310471504
37 1.002022793844247 1.0000234586253944 51.773788755202204
38 1.0061407489734806 1.0004593132554458 56.58789735962104
39 1.0087304310462555 1.0007873551522404 59.33694500506314
40 1.009085854603015 1.0009302245791594 59.714004591000744
41 1.0071640602443972 1.0008523501197881 56.65490987131541
42 1.003572578812704 1.0005765816975956 51.359617958814646
43 0.9993254309005892 1.0001817998665328 45.896502386420586
44 0.9955061415675478 0.9997810207141345 41.61015116250623
45 0.9929825239913758 0.9994884550911597 39.017224670765955
46 0.992243597361587 0.9993870708699335 38.265326899884144
47 0.9933544098246885 0.9995060636809904 40.133054899144334
48 0.9959928264797866 0.999813549709988 44.43323743045732
49 0.9995364808927122 1.0002259045584656 49.662976161858325
50 1.0031837526854632 1.0006315450877035 54.41806966080533
51 1.0061021795899932 1.0009229297838282 57.84924023988153
52 1.0075947443581947 1.001026786597022 59.527201315188215
53 1.007261226244084 1.0009218433968667 58.96236540907548
54 1.005116793199719 1.000638339010917 55.327207110391086
55 1.0016250204350823 1.0002426933102517 49.929337394341594
56 0.9976165148984415 0.9998172601735186 44.555260949615615
57 0.9940965773656751 0.9994437706353104 40.43914883953237
58 0.9919840916744096 0.9991921956429434 38.160656641948364
59 0.9918531076899305 0.999111523049983 38.01762253824275
60 0.9937568987522472 0.9992196160064587 41.452549579003154
61 0.9971973140661597 0.9994941091665639 47.152250363023654
62 1.0012608848264895 0.9998703990484712 52.97531490233398
63 1.0048854290532758 1.0002524667742259 57.47610165041397
64 1.007167955358867 1.000537052679469 60.06807122484348
65 1.007606174744058 1.0006444809047594 60.56505085696511
66 1.0061978455976288 1.0005447024218619 58.064000021934916
67 1.0033872093786016 1.0002679869314701 53.330711631168185
68 0.999905938746761 0.9998957830419731 48.1004546511982
69 0.9965777326437868 0.9995352624854521 43.689064180203566
70 0.9941415893444104 0.9992870535173071 40.74354133683618
71 0.9931200668599705 0.9992173027668997 39.53974424051918
72 0.9937361152841923 0.9993424473104557 40.678056703575464
73 0.9958741083421865 0.9996296616427597 44.57792898526234
74 0.9990855848140147 1.000010282075743 49.90526661382926
75 1.0026500784819516 1.0003997652482997 55.06780072153848
76 1.0057051809905053 1.0007172149743007 58.97061999832174
77 1.0074459357507306 1.0009001083098332 61.04677907809826
78 1.007357474771272 1.0009136454107193 60.87819123715923
79 1.0054020814723927 1.0007562101770289 57.12292288138808
80 1.0020691777024513 1.0004613053273732 51.31288450153303
81 0.9982432499438905 1.0000938796534653 45.581543117736