lawsynth/crates/lawsynth-preprocess/tests/transform_integration.rs
caelum0x 68f07af53b feat(product): Studio↔live services, C/ONNX/MATLAB export, notebook widget, 3x faster ingest
Wave 8 — depth across four fronts:
Studio — @lawsynth/api-client gains the real discovery-run endpoints; the Studio
discovery flow now drives the LIVE client (submit -> bounded-poll -> getWorld ->
feed screens), with an in-memory fake transport for offline end-to-end tests.

Export — lawsynth export --format c|onnx|matlab. The C compiles clean and matches
the engine to ~1e-14; ONNX is an honest computation-graph JSON (each node mapped
to its standard ONNX op, DAG-interned, evaluator-verified); MATLAB .m emitted.

Notebook — WorldExplorerWidget: a self-contained embedded-JS widget that
re-simulates in-browser on slider drag (no kernel round-trip); factors each
discovered coefficient into a tunable parameter. study.discover().explore().

Performance — single-pass streaming CSV parser: 3.19x faster ingest (500k rows
224ms->70ms, 328 MiB/s; 1M rows 7.2M rows/s), byte-for-byte identical output
(equivalence-tested), plus streaming Read-based loaders + progress callbacks + a
scale benchmark.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-17 23:09:54 +03:00

18 lines
752 B
Rust

use lawsynth_preprocess::{ImputationMethod, PreprocessError, impute_series};
#[test]
fn imputation_is_explicit_about_method_and_boundary_evidence() {
let time = [0.0, 1.0, 3.0, 4.0];
let values = [Some(0.0), None, Some(6.0), Some(8.0)];
let (linear, report) = impute_series(&time, &values, ImputationMethod::Linear).unwrap();
assert_eq!(linear, vec![0.0, 2.0, 6.0, 8.0]);
assert_eq!(report.imputed_indices, vec![1]);
let (mean, _) = impute_series(&time, &values, ImputationMethod::Mean).unwrap();
assert_eq!(mean, vec![0.0, 14.0 / 3.0, 6.0, 8.0]);
assert_eq!(
impute_series(&time, &[None, Some(1.0), Some(2.0), Some(3.0)], ImputationMethod::Linear),
Err(PreprocessError::MissingBoundaryValue)
);
}