00001 00002 /*============================================================================= 00003 physical quantities / units / constants 00004 Copyright (c) 2006, 2007 Martin Schulz 00005 http://physical.sourceforge.net 00006 00007 This is private code by Martin Schulz. 00008 00009 Use, modification and distribution is subject to the Boost Software 00010 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 00011 http://www.boost.org/LICENSE_1_0.txt) 00012 =============================================================================*/ 00013 00014 #include <boost/test/auto_unit_test.hpp> 00015 00016 #include "physical/dynamicphysical.hpp" 00017 #include "physical/unit.hpp" 00018 00019 namespace quantity=physical::quantity_si_double; 00020 namespace unit=physical::unit_si_double; 00021 00022 00023 BOOST_AUTO_UNIT_TEST( conversion_exception_test ) { 00024 00025 try { 00026 physical::DynamicPhysical<SI> length = 200*unit::meter; 00027 00028 // this is an invalid conversion and should throw an exception: 00029 quantity::temperature temp = length; 00030 00031 // if we arrive, here, it is an error.. 00032 BOOST_ERROR("Incompatible conversion from length to temperature succeeded!"); 00033 00034 } catch(const physical::IncompatibleUnitException& ){ 00035 // ok, no error 00036 00037 } catch(...) { 00038 BOOST_ERROR("Errorneous exception."); 00039 } 00040 00041 };
Generated on Mon Apr 2 22:25:06 2007 for physical_svn by 1.5.1-p1 | hosted on |