Reorganize the shared example code

The new layout deviates from what the Rust book suggests

  https://doc.rust-lang.org/book/ch11-03-test-organization.html#submodules-in-integration-tests

and uses the frowned-upon `#[path]` attribute,

  https://doc.rust-lang.org/style-guide/advice.html#modules

but we've decided that having a descriptive module filename instead of
`mod.rs` is worth the cost.
This commit is contained in:
Aaron Fenyes 2025-07-18 10:59:41 -07:00
parent 2137284358
commit 477d6a5064
5 changed files with 30 additions and 51 deletions

View file

@ -1,18 +1,13 @@
mod common;
#[path = "common/print.rs"]
mod print;
use common::{
print_gram_matrix,
print_loss_history,
print_realization_diagnostics,
print_title
};
use dyna3::engine::{Realization, examples::realize_irisawa_hexlet};
fn main() {
const SCALED_TOL: f64 = 1.0e-12;
let realization_result = realize_irisawa_hexlet(SCALED_TOL);
print_title("Irisawa hexlet");
print_realization_diagnostics(&realization_result);
print::title("Irisawa hexlet");
print::realization_diagnostics(&realization_result);
if let Ok(Realization { config, .. }) = realization_result.result {
// print the diameters of the chain spheres
println!("\nChain diameters:");
@ -22,7 +17,7 @@ fn main() {
}
// print the completed Gram matrix
print_gram_matrix(&config);
print::gram_matrix(&config);
}
print_loss_history(&realization_result.history);
print::loss_history(&realization_result.history);
}