use assert2::check;
use hoomd_interaction::{
MaximumInteractionRange, SitePairEnergy,
pairwise::{AngularMask, Anisotropic, HardSphere},
univariate::Boxcar,
};
use hoomd_vector::Cartesian;
struct One;
struct Two;
struct Three;
impl MaximumInteractionRange for One {
fn maximum_interaction_range(&self) -> f64 {
1.0
}
}
impl MaximumInteractionRange for Two {
fn maximum_interaction_range(&self) -> f64 {
2.0
}
}
impl MaximumInteractionRange for Three {
fn maximum_interaction_range(&self) -> f64 {
3.0
}
}
#[derive(MaximumInteractionRange)]
struct Unit;
#[test]
fn unit() {
let unit = Unit;
check!(unit.maximum_interaction_range() == 0.0);
}
#[derive(MaximumInteractionRange)]
struct CombinedNamed {
one: One,
two: Two,
three: Three,
}
#[test]
fn combined_named() {
let combined_named = CombinedNamed {
one: One,
two: Two,
three: Three,
};
check!(combined_named.maximum_interaction_range() == 3.0);
}
#[derive(MaximumInteractionRange)]
struct CombinedUnnamed(One, Two, Three);
#[test]
fn combined_unnamed() {
let combined_unnamed = CombinedUnnamed(One, Two, Three);
check!(combined_unnamed.maximum_interaction_range() == 3.0);
}
#[derive(MaximumInteractionRange)]
struct SitePair {
maximum_interaction_range: f64,
}
#[test]
fn site_pair() {
let site_pair = SitePair {
maximum_interaction_range: 5.0,
};
check!(site_pair.maximum_interaction_range() == 5.0);
}
#[allow(dead_code, reason = "The test passes if it compiles")]
#[derive(MaximumInteractionRange, SitePairEnergy)]
struct SitePairInteraction {
hard_disk: HardSphere,
angular_mask: Anisotropic<AngularMask<Boxcar, Cartesian<2>>>,
}