Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
crystal-growth committed Aug 12, 2022
1 parent 73158b3 commit 0803061
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/si/dynamic_viscosity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ quantity! {
@pound_force_second_per_square_inch: 4.448_222_E0 / 2.54_E-2 / 2.54_E-2; "lbf · s/in²",
"pound-force second per square inch", "pound-force seconds per square inch";
// Reyn = 1 lbf · s/in²
@reyn: 4.448_222_E0 / 2.54_E-2 / 2.54_E-2; "reyn", "reyn", "reyn";
@reyn: 4.448_222_E0 / 2.54_E-2 / 2.54_E-2; "reyn", "reyn", "reyns";
@pound_per_foot_second: 4.535_924_E-1 / 3.048_E-1; "lb/(ft · s)", "pound per foot second",
"pounds per foot second";
@pound_per_foot_hour: 4.535_924_E-1 / 3.048_E-1 / 3.6_E3; "lb/(ft · h)",
Expand Down Expand Up @@ -58,17 +58,17 @@ mod test {
#[test]
fn check_units() {
test::<p::pascal, t::second, dv::pascal_second>();
test::<dv::millipascal_second, t::second, p::millipascal>();
test::<dv::micropascal_second, t::second, p::micropascal>();
test::<dv::poise, t::second, p::dyne_per_square_centimeter>();
test::<dv::centipoise, t::second, p::millipascal>();
test::<dv::pound_force_second_per_square_foot, t::second,
p::pound_force_per_square_foot>();
test::<dv::pound_force_second_per_square_inch, t::second,
p::pound_force_per_square_inch>();
test::<dv::reyn, t::second, p::pound_force_per_square_inch>();
test::<p::millipascal, t::second, dv::millipascal_second>();
test::<p::micropascal, t::second, dv::micropascal_second>();
test::<p::dyne_per_square_centimeter, t::second, dv::poise>();
test::<p::millipascal, t::second,dv::centipoise>();
test::<p::pound_force_per_square_foot, t::second,
dv::pound_force_second_per_square_foot>();
test::<p::pound_force_per_square_inch, t::second,
dv::pound_force_second_per_square_inch>();
test::<p::pound_force_per_square_inch, t::second, dv::reyn>();

fn test<DV: dv::Conversion<V>, T: t::Conversion<V>, P: p::Conversion<V>>() {
fn test<P: p::Conversion<V>, T: t::Conversion<V>, DV: dv::Conversion<V>>() {
Test::assert_approx_eq(&DynamicViscosity::new::<DV>(V::one()),
&(Pressure::new::<P>(V::one())
* Time::new::<T>(V::one())));
Expand All @@ -78,12 +78,11 @@ mod test {
#[test]
fn check_units_mlt() {
test::<m::pound, l::foot, t::second, dv::pound_per_foot_second>();
test::<dv::pound_per_foot_hour, t::hour, m::pound, l::foot>();
test::<dv::gram_per_centimeter_second, t::second, m::gram, l::centimeter>();
test::<dv::slug_per_foot_second, t::second, m::slug, l::foot>();
test::<m::pound, l::foot, t::hour, dv::pound_per_foot_hour>();
test::< m::gram, l::centimeter, t::second, dv::gram_per_centimeter_second>();
test::< m::slug, l::foot, t::second, dv::slug_per_foot_second>();

fn test<DV: dv::Conversion<V>, T: t::Conversion<V>, M: m::Conversion<V>,
L: l::Conversion<V>>()
fn test<M: m::Conversion<V>, L: l::Conversion<V>, T: t::Conversion<V>, DV: dv::Conversion<V>>()
{
Test::assert_approx_eq(&DynamicViscosity::new::<DV>(V::one()),
&(Mass::new::<M>(V::one())
Expand Down

0 comments on commit 0803061

Please sign in to comment.