|
From: Steven W. <ste...@us...> - 2007-03-29 20:06:00
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21924/boost-sandbox/libs/units/test Modified Files: test_conversion.cpp Log Message: Added test for converting unit and value_type simultaniously Index: test_conversion.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/test/test_conversion.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- test_conversion.cpp 16 Mar 2007 18:29:54 -0000 1.1.1.1 +++ test_conversion.cpp 29 Mar 2007 20:05:58 -0000 1.2 @@ -71,6 +71,24 @@ bu::quantity<mixed_energy_2> e4(e3); BOOST_CHECK((std::abs(e4.value() - 20.0) < .0001)); + + + bu::quantity<bu::CGS::force> F0 = 20 * bu::CGS::dyne; + BOOST_CHECK((std::abs(F0.value() - 20.0) < .0001)); + + bu::quantity<bu::SI::force> F1 = bu::quantity_cast<bu::quantity<bu::SI::force> >(F0); + BOOST_CHECK((std::abs(F1.value() - 2.0e-4) < .000000001)); + bu::quantity<bu::SI::force> F2 = bu::quantity_cast<bu::quantity<bu::SI::force> >(20 * bu::CGS::dyne); + BOOST_CHECK((std::abs(F2.value() - 2.0e-4) < .000000001)); + + bu::quantity<bu::SI::force> F3(F0); + BOOST_CHECK((std::abs(F3.value() - 2.0e-4) < .000000001)); + //quantity<SI::force> F4 = F0; + + bu::quantity<bu::SI::force> F5(20 * bu::CGS::dyne); + BOOST_CHECK((std::abs(F5.value() - 2.0e-4) < .000000001)); + //quantity<SI::force> F6 = 20 * CGS::dyne; + return(0); } |