1pub mod engine;
36pub mod harmonic_oscillator;
37pub mod kepler_orbit;
38pub mod kingmans_hockey;
39pub mod littles_law_factory;
40pub mod monte_carlo_pi;
41pub mod orbit_engine;
42pub mod tsp_engine;
43pub mod tsp_grasp;
44pub mod tsp_instance;
45
46#[cfg(feature = "wasm")]
48#[allow(clippy::unwrap_used)]
49#[allow(clippy::expect_used)]
50#[allow(clippy::missing_panics_doc)]
51#[allow(clippy::missing_errors_doc)]
52#[allow(clippy::cast_lossless)]
53#[allow(clippy::redundant_closure_for_method_calls)]
54#[allow(clippy::manual_let_else)]
55pub mod tsp_wasm_app;
56
57#[cfg(feature = "wasm")]
58#[allow(clippy::unwrap_used)]
59#[allow(clippy::expect_used)]
60#[allow(clippy::missing_panics_doc)]
61#[allow(clippy::missing_errors_doc)]
62#[allow(clippy::cast_lossless)]
63#[allow(clippy::redundant_closure_for_method_calls)]
64#[allow(clippy::manual_let_else)]
65pub mod orbit_wasm_app;
66
67pub use engine::{
69 CriterionResult, DemoEngine, DemoError, DemoMeta, DeterministicReplay, FalsificationCriterion,
70 MetamorphicRelation, MrResult, RendererIndependent, Severity,
71};
72pub use harmonic_oscillator::HarmonicOscillatorDemo;
73pub use kepler_orbit::KeplerOrbitDemo;
74pub use kingmans_hockey::KingmanHockeyDemo;
75pub use littles_law_factory::LittlesLawFactoryDemo;
76pub use monte_carlo_pi::MonteCarloPlDemo;
77pub use orbit_engine::{OrbitConfig, OrbitalEngine, OrbitalState, OrbitalStepResult};
78pub use tsp_engine::{TspConfig, TspEngine, TspState, TspStepResult};
79pub use tsp_grasp::TspGraspDemo;
80pub use tsp_instance::{
81 Coords, TspAlgorithmConfig, TspCity, TspInstanceError, TspInstanceYaml, TspMeta, TspParams,
82};
83
84use serde::{Deserialize, Serialize};
85
86pub trait EddDemo {
88 fn name(&self) -> &'static str;
90
91 fn emc_ref(&self) -> &'static str;
93
94 fn step(&mut self, dt: f64);
96
97 fn verify_equation(&self) -> bool;
99
100 fn get_falsification_status(&self) -> FalsificationStatus;
102
103 fn reset(&mut self);
105}
106
107#[derive(Debug, Clone, Serialize, Deserialize)]
109pub struct FalsificationStatus {
110 pub verified: bool,
112 pub criteria: Vec<CriterionStatus>,
114 pub message: String,
116}
117
118#[derive(Debug, Clone, Serialize, Deserialize)]
120pub struct CriterionStatus {
121 pub id: String,
123 pub name: String,
125 pub passed: bool,
127 pub value: f64,
129 pub threshold: f64,
131}
132
133#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
135pub enum IntegratorType {
136 #[default]
138 StormerVerlet,
139 RK4,
141 Euler,
143}
144
145#[cfg(test)]
146mod tests {
147 use super::*;
148
149 #[test]
150 fn test_integrator_type_default() {
151 assert_eq!(IntegratorType::default(), IntegratorType::StormerVerlet);
152 }
153
154 #[test]
155 fn test_falsification_status_serialization() {
156 let status = FalsificationStatus {
157 verified: true,
158 criteria: vec![CriterionStatus {
159 id: "TEST-001".to_string(),
160 name: "Test criterion".to_string(),
161 passed: true,
162 value: 0.0,
163 threshold: 1e-10,
164 }],
165 message: "All criteria passed".to_string(),
166 };
167
168 let json = serde_json::to_string(&status).expect("serialize");
169 assert!(json.contains("TEST-001"));
170 }
171}