Turn non-automated tests into Cargo examples #24

Open
Vectornaut wants to merge 5 commits from cargo-examples_on_main into main
2 changed files with 4 additions and 6 deletions
Showing only changes of commit 848f7d665b - Show all commits

View File

@ -6,7 +6,7 @@ edition = "2021"
[features] [features]
default = ["console_error_panic_hook"] default = ["console_error_panic_hook"]
irisawa = [] dev = []
[dependencies] [dependencies]
itertools = "0.13.0" itertools = "0.13.0"
@ -42,7 +42,7 @@ features = [
# https://github.com/rust-lang/cargo/issues/2911#issuecomment-1483256987 # https://github.com/rust-lang/cargo/issues/2911#issuecomment-1483256987
# #
[dev-dependencies] [dev-dependencies]
dyna3 = { path = ".", default-features = false, features = ["irisawa"] } dyna3 = { path = ".", default-features = false, features = ["dev"] }
wasm-bindgen-test = "0.3.34" wasm-bindgen-test = "0.3.34"
[profile.release] [profile.release]

View File

@ -4,9 +4,7 @@ use web_sys::{console, wasm_bindgen::JsValue}; /* DEBUG */
// --- elements --- // --- elements ---
/* KLUDGE */ #[cfg(feature = "dev")]
// temporarily remove test gate so we can use `point` in examples
/* #[cfg(test)] */
pub fn point(x: f64, y: f64, z: f64) -> DVector<f64> { pub fn point(x: f64, y: f64, z: f64) -> DVector<f64> {
DVector::from_column_slice(&[x, y, z, 0.5, 0.5*(x*x + y*y + z*z)]) DVector::from_column_slice(&[x, y, z, 0.5, 0.5*(x*x + y*y + z*z)])
} }
@ -287,7 +285,7 @@ pub fn realize_gram(
// "Japan's 'Wasan' Mathematical Tradition", by Abe Haruki // "Japan's 'Wasan' Mathematical Tradition", by Abe Haruki
// https://www.nippon.com/en/japan-topics/c12801/ // https://www.nippon.com/en/japan-topics/c12801/
// //
#[cfg(feature = "irisawa")] #[cfg(feature = "dev")]
pub mod irisawa { pub mod irisawa {
use std::{array, f64::consts::PI}; use std::{array, f64::consts::PI};