sim_lib_view_math/cookbook.rs
1//! Deterministic cookbook builders for math view recipes.
2
3use sim_kernel::Expr;
4
5use crate::plot_view;
6
7/// Build the plot Scene used by the cookbook recipe.
8pub fn plot_series_demo() -> Expr {
9 let scene = plot_view("y = x^2", &[(0.0, 0.0), (1.0, 1.0), (2.0, 4.0)]);
10 debug_assert!(sim_lib_scene::validate_scene(&scene).is_ok());
11 scene
12}
13
14#[cfg(test)]
15mod tests {
16 use super::*;
17
18 #[test]
19 fn plot_series_demo_is_a_valid_scene() {
20 sim_lib_scene::validate_scene(&plot_series_demo()).expect("plot scene validates");
21 }
22}