use async_graphql::OutputType;
use super::WireScore;
fn width<S: WireScore>() -> String {
<<S as WireScore>::Wire<'static> as OutputType>::type_name().into_owned()
}
#[test]
fn a_score_renders_the_width_its_engine_measures_in() {
assert_eq!(width::<f32>(), "f32");
assert_eq!(width::<f64>(), "f64");
assert_ne!(width::<f32>(), width::<f64>());
assert_eq!(<f32 as OutputType>::type_name(), "Float");
assert_eq!(<f64 as OutputType>::type_name(), "Float");
}
#[test]
fn an_integer_currency_crosses_at_its_own_width() {
assert_eq!(width::<u64>(), "u64");
assert_eq!(width::<i32>(), "i32");
assert_eq!(width::<u128>(), "u128");
assert_eq!(width::<crate::Score>(), "f32");
assert_eq!(width::<crate::Confidence<f64>>(), "f64");
}
#[test]
fn the_crossing_carries_the_value_and_not_only_its_name() {
assert_eq!(
<f32 as WireScore>::wire_score(&0.5_f32),
crate::F32::from(0.5_f32),
);
assert_eq!(
<u64 as WireScore>::wire_score(&u64::MAX),
crate::U64::from(u64::MAX),
);
}