// Boost.Units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2008 Matthias Christian Schabel // Copyright (C) 2008 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) /** \file \brief test_predicates.cpp \details Test metafunctions is_unit, is_quantity, is_dimension_list .... Output: @verbatim @endverbatim **/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace bu = boost::units; struct dimension_tag : boost::units::base_dimension { }; typedef dimension_tag::dimension_type dimension; struct base_unit1 : bu::base_unit {}; struct base_unit2 : bu::base_unit {}; typedef bu::make_system::type system1; typedef bu::make_system::type system2; int main(int,char *[]) { BOOST_MPL_ASSERT((bu::is_dimension_list)); BOOST_MPL_ASSERT((bu::is_dimension_list)); BOOST_MPL_ASSERT_NOT((bu::is_dimension_list >)); BOOST_MPL_ASSERT_NOT((bu::is_dimension_list)); BOOST_MPL_ASSERT((bu::is_unit >)); BOOST_MPL_ASSERT((bu::is_unit >)); BOOST_MPL_ASSERT_NOT((bu::is_unit)); BOOST_MPL_ASSERT((bu::is_unit_of_system, system1>)); BOOST_MPL_ASSERT((bu::is_unit_of_system, system1>)); BOOST_MPL_ASSERT_NOT((bu::is_unit_of_system, system2>)); BOOST_MPL_ASSERT_NOT((bu::is_unit_of_system, system2>)); BOOST_MPL_ASSERT_NOT((bu::is_unit_of_system)); BOOST_MPL_ASSERT_NOT((bu::is_unit_of_system)); BOOST_MPL_ASSERT((bu::is_unit_of_dimension, bu::dimensionless_type>)); BOOST_MPL_ASSERT((bu::is_unit_of_dimension, dimension>)); BOOST_MPL_ASSERT_NOT((bu::is_unit_of_dimension, dimension>)); BOOST_MPL_ASSERT_NOT((bu::is_unit_of_dimension, bu::dimensionless_type>)); BOOST_MPL_ASSERT_NOT((bu::is_unit_of_dimension)); BOOST_MPL_ASSERT_NOT((bu::is_unit_of_dimension)); BOOST_MPL_ASSERT((bu::is_quantity > >)); BOOST_MPL_ASSERT((bu::is_quantity > >)); BOOST_MPL_ASSERT_NOT((bu::is_quantity)); BOOST_MPL_ASSERT((bu::is_quantity, int> >)); BOOST_MPL_ASSERT((bu::is_quantity, int> >)); BOOST_MPL_ASSERT((bu::is_quantity_of_system >, system1>)); BOOST_MPL_ASSERT((bu::is_quantity_of_system >, system1>)); BOOST_MPL_ASSERT_NOT((bu::is_quantity_of_system >, system2>)); BOOST_MPL_ASSERT_NOT((bu::is_quantity_of_system >, system2>)); BOOST_MPL_ASSERT_NOT((bu::is_quantity_of_system)); BOOST_MPL_ASSERT_NOT((bu::is_quantity_of_system)); BOOST_MPL_ASSERT((bu::is_quantity_of_dimension >, bu::dimensionless_type>)); BOOST_MPL_ASSERT((bu::is_quantity_of_dimension >, dimension>)); BOOST_MPL_ASSERT_NOT((bu::is_quantity_of_dimension >, dimension>)); BOOST_MPL_ASSERT_NOT((bu::is_quantity_of_dimension >, bu::dimensionless_type>)); BOOST_MPL_ASSERT_NOT((bu::is_quantity_of_dimension)); BOOST_MPL_ASSERT_NOT((bu::is_quantity_of_dimension)); return 0; }