00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <boost/test/auto_unit_test.hpp>
00015
00016
00017 #include "physical/fixedphysical.hpp"
00018 #include "physical/quantity.hpp"
00019
00020 #include <boost/static_assert.hpp>
00021 #include <boost/type_traits/is_same.hpp>
00022 #include <boost/type_traits/is_convertible.hpp>
00023
00024 namespace quantity=physical::quantity_si_double;
00025
00026
00027 BOOST_AUTO_UNIT_TEST( static_conversion_test ) {
00028
00029 BOOST_STATIC_ASSERT((boost::is_convertible<int, double>::value));
00030 BOOST_STATIC_ASSERT((!boost::is_convertible<int, double*>::value));
00031
00032
00033
00034
00035 BOOST_STATIC_ASSERT((!boost::is_convertible<quantity::time, quantity::length>::value));
00036 BOOST_STATIC_ASSERT((!boost::is_convertible<quantity::area, quantity::length>::value));
00037 BOOST_STATIC_ASSERT((!boost::is_convertible<quantity::volume, quantity::length>::value));
00038 BOOST_STATIC_ASSERT((!boost::is_convertible<quantity::volume, quantity::area>::value));
00039
00040
00041
00042 typedef physical::FixedPhysicalRatio<quantity::area, quantity::length>::type length1;
00043 BOOST_STATIC_ASSERT((boost::is_same<quantity::length::exponents, length1::exponents>::value));
00044 BOOST_STATIC_ASSERT((boost::is_same<length1, quantity::length>::value));
00045 BOOST_STATIC_ASSERT((boost::is_same<quantity::length, length1>::value));
00046
00047 typedef physical::FixedPhysicalRatio<quantity::volume, quantity::area>::type length2;
00048 BOOST_STATIC_ASSERT((boost::is_same<quantity::length::exponents, length2::exponents>::value));
00049 BOOST_STATIC_ASSERT((boost::is_same<length2, quantity::length>::value));
00050 BOOST_STATIC_ASSERT((boost::is_same<quantity::length, length2>::value));
00051
00052 typedef physical::FixedPhysicalProduct<quantity::velocity, quantity::time>::type length3;
00053 BOOST_STATIC_ASSERT((boost::is_same<quantity::length::exponents, length3::exponents>::value));
00054 BOOST_STATIC_ASSERT((boost::is_same<length3, quantity::length>::value));
00055 BOOST_STATIC_ASSERT((boost::is_same<quantity::length, length3>::value));
00056
00057
00058
00059 BOOST_STATIC_ASSERT((boost::is_convertible<physical::quantity_si_float::length, physical::quantity_si_double::length>::value));
00060 BOOST_STATIC_ASSERT((boost::is_convertible<physical::quantity_si_double::length, physical::quantity_si_float::length>::value));
00061
00062 };
00063
00064
00065
00066
00067
00068
00069 #include <iostream>
00070
00071 BOOST_AUTO_UNIT_TEST( static_unit_conversion_test ) {
00072 std::cout << "static_unit_conversion_test not implemented yet.\n" ;
00073 };