|
Boost-Commit : |
From: matthiasschabel_at_[hidden]
Date: 2007-05-31 14:57:59
Author: matthiasschabel
Date: 2007-05-31 14:57:58 EDT (Thu, 31 May 2007)
New Revision: 4389
URL: http://svn.boost.org/trac/boost/changeset/4389
Log:
fix tests/examples
Text files modified:
sandbox/units/libs/units/example/test_system.hpp | 12 +-
sandbox/units/libs/units/example/unit_example_1.cpp | 8 +-
sandbox/units/libs/units/example/unit_example_16.cpp | 4
sandbox/units/libs/units/example/unit_example_20.cpp | 4
sandbox/units/libs/units/example/unit_example_21.cpp | 32 +++++-----
sandbox/units/libs/units/example/unit_example_22.cpp | 2
sandbox/units/libs/units/example/unit_example_4.cpp | 4
sandbox/units/libs/units/test/fail_heterogeneous_unit.cpp | 4
sandbox/units/libs/units/test/test_absolute.cpp | 125 +++++++++++++++++++--------------------
sandbox/units/libs/units/test/test_header.hpp | 16 ++--
10 files changed, 106 insertions(+), 105 deletions(-)
Modified: sandbox/units/libs/units/example/test_system.hpp
==============================================================================
--- sandbox/units/libs/units/example/test_system.hpp (original)
+++ sandbox/units/libs/units/example/test_system.hpp 2007-05-31 14:57:58 EDT (Thu, 31 May 2007)
@@ -49,18 +49,18 @@
#if 0
//[test_system_snippet_4
-typedef make_dimension_list< boost::mpl::list< dim< length_base_dimension,static_rational<2> > > >::type area_dim;
+typedef make_dimension_list< boost::mpl::list< dim< length_base_dimension,static_rational<2> > > >::type area_dimension;
typedef make_dimension_list< boost::mpl::list< dim< mass_base_dimension,static_rational<1> >,
dim< length_base_dimension,static_rational<2> >,
- dim< time_base_dimension,static_rational<-2> > > >::type energy_dim;
+ dim< time_base_dimension,static_rational<-2> > > >::type energy_dimension;
//]
#endif
//[test_system_snippet_5
-typedef derived_dimension<length_base_dimension,2>::type area_dim;
+typedef derived_dimension<length_base_dimension,2>::type area_dimension;
typedef derived_dimension<mass_base_dimension,1,
length_base_dimension,2,
- time_base_dimension,-2>::type energy_dim;
+ time_base_dimension,-2>::type energy_dimension;
//]
namespace test {
@@ -88,8 +88,8 @@
typedef unit<mass_dimension,mks_system> mass;
typedef unit<time_dimension,mks_system> time;
-typedef unit<area_dim,mks_system> area;
-typedef unit<energy_dim,mks_system> energy;
+typedef unit<area_dimension,mks_system> area;
+typedef unit<energy_dimension,mks_system> energy;
//]
//[test_system_snippet_7
Modified: sandbox/units/libs/units/example/unit_example_1.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_1.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_1.cpp 2007-05-31 14:57:58 EDT (Thu, 31 May 2007)
@@ -23,7 +23,7 @@
length_dimension = dimension_list<dim<length_base_dimension, static_rational<1l, 1l> >, dimensionless_type>
mass_dimension = dimension_list<dim<mass_base_dimension, static_rational<1l, 1l> >, dimensionless_type>
time_dimension = dimension_list<dim<time_base_dimension, static_rational<1l, 1l> >, dimensionless_type>
-energy_dim = dimension_list<dim<length_base_dimension, static_rational<2l, 1l> >, dimension_list<dim<mass_base_dimension, static_rational<1l, 1l> >, dimension_list<dim<time_base_dimension, static_rational<-2l, 1l> >, dimensionless_type> > >
+energy_dimension = dimension_list<dim<length_base_dimension, static_rational<2l, 1l> >, dimension_list<dim<mass_base_dimension, static_rational<1l, 1l> >, dimension_list<dim<time_base_dimension, static_rational<-2l, 1l> >, dimensionless_type> > >
LM_type = dimension_list<dim<length_base_dimension, static_rational<1l, 1l> >, dimension_list<dim<mass_base_dimension, static_rational<1l, 1l> >, dimensionless_type> >
L_T_type = dimension_list<dim<length_base_dimension, static_rational<1l, 1l> >, dimension_list<dim<time_base_dimension, static_rational<-1l, 1l> >, dimensionless_type> >
V_type = dimension_list<dim<length_base_dimension, static_rational<1l, 1l> >, dimension_list<dim<time_base_dimension, static_rational<-1l, 1l> >, dimensionless_type> >
@@ -53,7 +53,7 @@
BOOST_MPL_ASSERT((boost::is_same<length_dimension, mpl::push_front<dimensionless_type, dim<length_base_dimension, static_rational<1L, 1L> > >::type>));
BOOST_MPL_ASSERT((boost::is_same<mass_dimension, mpl::push_front<dimensionless_type, dim<mass_base_dimension, static_rational<1L, 1L> > >::type>));
- BOOST_MPL_ASSERT((boost::is_same<energy_dim,
+ BOOST_MPL_ASSERT((boost::is_same<energy_dimension,
mpl::push_front<
mpl::push_front<
mpl::push_front<
@@ -65,12 +65,12 @@
std::cout << "length_dimension = " << simplify_typename(length_dimension()) << std::endl
<< "mass_dimension = " << simplify_typename(mass_dimension()) << std::endl
<< "time_dimension = " << simplify_typename(time_dimension()) << std::endl
- << "energy_dim = " << simplify_typename(energy_dim()) << std::endl;
+ << "energy_dimension = " << simplify_typename(energy_dimension()) << std::endl;
//[unit_example_1_snippet_1
typedef mpl::times<length_dimension,mass_dimension>::type LM_type;
typedef mpl::divides<length_dimension,time_dimension>::type L_T_type;
- typedef static_root<mpl::divides<energy_dim,mass_dimension>::type,static_rational<2> >::type V_type;
+ typedef static_root<mpl::divides<energy_dimension,mass_dimension>::type,static_rational<2> >::type V_type;
//]
BOOST_MPL_ASSERT((boost::is_same<LM_type,
Modified: sandbox/units/libs/units/example/unit_example_16.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_16.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_16.cpp 2007-05-31 14:57:58 EDT (Thu, 31 May 2007)
@@ -75,7 +75,7 @@
} // namespace boost
-BOOST_UNITS_DEFINE_CONVERSION(boost::units::nautical::length_base_unit, boost::units::meter_tag::unit_type, double, 1.852e3);
+BOOST_UNITS_DEFINE_CONVERSION(boost::units::nautical::length_base_unit, boost::units::meter_base_unit::unit_type, double, 1.852e3);
namespace boost {
@@ -110,7 +110,7 @@
} // namespace boost
-BOOST_UNITS_DEFINE_CONVERSION(boost::units::imperial::length_base_unit, boost::units::meter_tag::unit_type, double, 1.0/3.28083989501312);
+BOOST_UNITS_DEFINE_CONVERSION(boost::units::imperial::length_base_unit, boost::units::meter_base_unit::unit_type, double, 1.0/3.28083989501312);
namespace boost {
Modified: sandbox/units/libs/units/example/unit_example_20.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_20.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_20.cpp 2007-05-31 14:57:58 EDT (Thu, 31 May 2007)
@@ -44,6 +44,8 @@
#include <boost/units/systems/si/temperature.hpp>
#include <boost/units/detail/utility.hpp>
+#include <boost/units/systems/base_units.hpp>
+
using namespace boost::units;
namespace boost {
@@ -52,7 +54,7 @@
namespace fahrenheit {
-typedef make_system<fahrenheit_tag>::type system;
+typedef make_system<fahrenheit_base_unit>::type system;
typedef unit<temperature_dimension,system> temperature;
Modified: sandbox/units/libs/units/example/unit_example_21.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_21.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_21.cpp 2007-05-31 14:57:58 EDT (Thu, 31 May 2007)
@@ -39,26 +39,26 @@
namespace units {
-struct imperial_gallon_tag : base_unit<imperial_gallon_tag, volume_dim, 1> { };
+struct imperial_gallon_tag : base_unit<imperial_gallon_tag, volume_dimension, 1> { };
typedef make_system<imperial_gallon_tag>::type imperial;
-typedef unit<volume_dim,imperial> imperial_gallon;
+typedef unit<volume_dimension,imperial> imperial_gallon;
-struct us_gallon_tag : base_unit<us_gallon_tag, volume_dim, 2> { };
+struct us_gallon_tag : base_unit<us_gallon_tag, volume_dimension, 2> { };
typedef make_system<us_gallon_tag>::type us;
-typedef unit<volume_dim,us> us_gallon;
+typedef unit<volume_dimension,us> us_gallon;
///// convert imperial gallons to us gallons
//template<class Y>
-//class conversion_helper< quantity<unit<volume_dim,imperial>,Y>,
-// quantity<unit<volume_dim,us>,Y> >
+//class conversion_helper< quantity<unit<volume_dimension,imperial>,Y>,
+// quantity<unit<volume_dimension,us>,Y> >
//{
// public:
-// typedef quantity<unit<volume_dim,imperial>,Y> from_quantity_type;
-// typedef quantity<unit<volume_dim,us>,Y> to_quantity_type;
+// typedef quantity<unit<volume_dimension,imperial>,Y> from_quantity_type;
+// typedef quantity<unit<volume_dimension,us>,Y> to_quantity_type;
//
// static
// to_quantity_type
@@ -70,12 +70,12 @@
//
///// convert us gallons to imperial gallons
//template<class Y>
-//class conversion_helper< quantity<unit<volume_dim,us>,Y>,
-// quantity<unit<volume_dim,imperial>,Y> >
+//class conversion_helper< quantity<unit<volume_dimension,us>,Y>,
+// quantity<unit<volume_dimension,imperial>,Y> >
//{
// public:
-// typedef quantity<unit<volume_dim,us>,Y> from_quantity_type;
-// typedef quantity<unit<volume_dim,imperial>,Y> to_quantity_type;
+// typedef quantity<unit<volume_dimension,us>,Y> from_quantity_type;
+// typedef quantity<unit<volume_dimension,imperial>,Y> to_quantity_type;
//
// static
// to_quantity_type
@@ -86,14 +86,14 @@
//};
template<>
-struct is_implicitly_convertible<unit<volume_dim,imperial>,
- unit<volume_dim,us> > :
+struct is_implicitly_convertible<unit<volume_dimension,imperial>,
+ unit<volume_dimension,us> > :
public mpl::true_
{ };
template<>
-struct is_implicitly_convertible<unit<volume_dim,us>,
- unit<volume_dim,imperial> > :
+struct is_implicitly_convertible<unit<volume_dimension,us>,
+ unit<volume_dimension,imperial> > :
public mpl::true_
{ };
Modified: sandbox/units/libs/units/example/unit_example_22.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_22.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_22.cpp 2007-05-31 14:57:58 EDT (Thu, 31 May 2007)
@@ -406,7 +406,7 @@
using namespace boost;
using namespace boost::units;
- typedef make_system<mpl::list<meter_tag,gram_tag,second_tag> >::type system1_type;
+ typedef make_system<mpl::list<meter_base_unit,gram_base_unit,second_base_unit> >::type system1_type;
std::cout << simplify_typename(system1_type()) << std::endl;
Modified: sandbox/units/libs/units/example/unit_example_4.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_4.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_4.cpp 2007-05-31 14:57:58 EDT (Thu, 31 May 2007)
@@ -179,8 +179,8 @@
//[unit_example_4_function_snippet_3
/// the physical definition of work - computed for an arbitrary unit system
template<class System,class Y>
-quantity<unit<energy_dim,System>,Y>
-work(quantity<unit<force_dim,System>,Y> F,
+quantity<unit<energy_dimension,System>,Y>
+work(quantity<unit<force_dimension,System>,Y> F,
quantity<unit<length_dimension,System>,Y> dx)
{
return F*dx;
Modified: sandbox/units/libs/units/test/fail_heterogeneous_unit.cpp
==============================================================================
--- sandbox/units/libs/units/test/fail_heterogeneous_unit.cpp (original)
+++ sandbox/units/libs/units/test/fail_heterogeneous_unit.cpp 2007-05-31 14:57:58 EDT (Thu, 31 May 2007)
@@ -30,8 +30,8 @@
namespace bu = boost::units;
template<class System>
-bu::quantity<bu::unit<bu::energy_dim, System> > f(bu::quantity<bu::unit<bu::length_dimension, System> > l) {
- return(static_cast<bu::quantity<bu::unit<bu::energy_dim, System> > >(f(static_cast<bu::quantity<bu::SI::length> >(l))));
+bu::quantity<bu::unit<bu::energy_dimension, System> > f(bu::quantity<bu::unit<bu::length_dimension, System> > l) {
+ return(static_cast<bu::quantity<bu::unit<bu::energy_dimension, System> > >(f(static_cast<bu::quantity<bu::SI::length> >(l))));
}
bu::quantity<bu::SI::energy> f(bu::quantity<bu::SI::length> l) {
return(l * l * 2.0 * bu::SI::kilograms / bu::pow<2>(bu::SI::seconds));
Modified: sandbox/units/libs/units/test/test_absolute.cpp
==============================================================================
--- sandbox/units/libs/units/test/test_absolute.cpp (original)
+++ sandbox/units/libs/units/test/test_absolute.cpp 2007-05-31 14:57:58 EDT (Thu, 31 May 2007)
@@ -1,63 +1,62 @@
-// mcs::units - A C++ library for zero-overhead dimensional analysis and
-// unit/quantity manipulation and conversion
-//
-// Copyright (C) 2003-2007 Matthias Christian Schabel
-// Copyright (C) 2007 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_absolute.cpp
-
-\detailed
-Test absolute units.
-
-Output:
-_at_verbatim
-_at_endverbatim
-**/
-
-#include <boost/units/quantity.hpp>
-#include <boost/units/absolute.hpp>
-#include <boost/units/unit.hpp>
-#include <boost/units/systems/derived_dimensions/temperature_derived_dimension.hpp>
-#include <boost/units/make_system.hpp>
-#include <boost/units/systems/base_units.hpp>
-
-#include <iostream>
-
-#include <boost/test/minimal.hpp>
-
-#define BOOST_UNITS_CHECK_CLOSE(a, b) (BOOST_CHECK((std::abs((a) - (b)) < .0000001)))
-
-namespace bu = boost::units;
-
-typedef bu::unit<bu::temperature_dimension,bu::make_system<bu::kelvin_tag>::type> kelvin_type;
-
-typedef bu::unit<bu::temperature_dimension,bu::make_system<bu::celsius_tag>::type> celsius_type;
-
-typedef bu::unit<bu::temperature_dimension,bu::make_system<bu::fahrenheit_tag>::type> fahrenheit_type;
-
-int test_main(int,char *[])
-{
- bu::quantity<bu::absolute<fahrenheit_type> > q1(212.0 * bu::absolute<fahrenheit_type>());
- bu::quantity<bu::absolute<celsius_type> > q2(0.0 * bu::absolute<celsius_type>());
- bu::quantity<bu::absolute<fahrenheit_type> > q3(q2);
- bu::quantity<fahrenheit_type> q4(q1 - q3);
-
- BOOST_UNITS_CHECK_CLOSE(q4.value(), 180.0);
-
- bu::quantity<bu::absolute<kelvin_type> > q5(static_cast<bu::quantity<kelvin_type> >(q4) + static_cast<bu::quantity<bu::absolute<kelvin_type> > >(q2));
-
- BOOST_UNITS_CHECK_CLOSE(q5.value(), 373.15);
-
- bu::quantity<bu::absolute<fahrenheit_type> > q6(q5);
-
- BOOST_UNITS_CHECK_CLOSE(q6.value(), 212.0);
-
- return(0);
-}
+// mcs::units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2007 Matthias Christian Schabel
+// Copyright (C) 2007 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_absolute.cpp
+
+\detailed
+Test absolute units.
+
+Output:
+@verbatim
+@endverbatim
+**/
+
+#include <boost/units/quantity.hpp>
+#include <boost/units/absolute.hpp>
+#include <boost/units/unit.hpp>
+#include <boost/units/make_system.hpp>
+#include <boost/units/systems/base_units.hpp>
+
+#include <iostream>
+
+#include <boost/test/minimal.hpp>
+
+#define BOOST_UNITS_CHECK_CLOSE(a, b) (BOOST_CHECK((std::abs((a) - (b)) < .0000001)))
+
+namespace bu = boost::units;
+
+typedef bu::unit<bu::temperature_dimension,bu::make_system<bu::kelvin_base_unit>::type> kelvin_type;
+
+typedef bu::unit<bu::temperature_dimension,bu::make_system<bu::celsius_base_unit>::type> celsius_type;
+
+typedef bu::unit<bu::temperature_dimension,bu::make_system<bu::fahrenheit_base_unit>::type> fahrenheit_type;
+
+int test_main(int,char *[])
+{
+ bu::quantity<bu::absolute<fahrenheit_type> > q1(212.0 * bu::absolute<fahrenheit_type>());
+ bu::quantity<bu::absolute<celsius_type> > q2(0.0 * bu::absolute<celsius_type>());
+ bu::quantity<bu::absolute<fahrenheit_type> > q3(q2);
+ bu::quantity<fahrenheit_type> q4(q1 - q3);
+
+ BOOST_UNITS_CHECK_CLOSE(q4.value(), 180.0);
+
+ bu::quantity<bu::absolute<kelvin_type> > q5(static_cast<bu::quantity<kelvin_type> >(q4) + static_cast<bu::quantity<bu::absolute<kelvin_type> > >(q2));
+
+ BOOST_UNITS_CHECK_CLOSE(q5.value(), 373.15);
+
+ bu::quantity<bu::absolute<fahrenheit_type> > q6(q5);
+
+ BOOST_UNITS_CHECK_CLOSE(q6.value(), 212.0);
+
+ return(0);
+}
Modified: sandbox/units/libs/units/test/test_header.hpp
==============================================================================
--- sandbox/units/libs/units/test/test_header.hpp (original)
+++ sandbox/units/libs/units/test/test_header.hpp 2007-05-31 14:57:58 EDT (Thu, 31 May 2007)
@@ -48,16 +48,16 @@
typedef mass_base_dimension::type mass_dimension;
typedef time_base_dimension::type time_dimension;
-typedef derived_dimension<length_base_dimension,2>::type area_dim;
+typedef derived_dimension<length_base_dimension,2>::type area_dimension;
typedef derived_dimension<mass_base_dimension,1,
length_base_dimension,2,
- time_base_dimension,-2>::type energy_dim;
+ time_base_dimension,-2>::type energy_dimension;
typedef derived_dimension<mass_base_dimension,-1,
length_base_dimension,-2,
time_base_dimension,2>::type inverse_energy_dim;
typedef derived_dimension<length_base_dimension,1,
- time_base_dimension,-1>::type velocity_dim;
-typedef derived_dimension<length_base_dimension,3>::type volume_dim;
+ time_base_dimension,-1>::type velocity_dimension;
+typedef derived_dimension<length_base_dimension,3>::type volume_dimension;
/// placeholder class defining test unit system
struct length_unit : base_unit<length_unit, length_dimension, 4> {};
@@ -73,11 +73,11 @@
typedef unit<mass_dimension,system> mass;
typedef unit<time_dimension,system> time;
-typedef unit<area_dim,system> area;
-typedef unit<energy_dim,system> energy;
+typedef unit<area_dimension,system> area;
+typedef unit<energy_dimension,system> energy;
typedef unit<inverse_energy_dim,system> inverse_energy;
-typedef unit<velocity_dim,system> velocity;
-typedef unit<volume_dim,system> volume;
+typedef unit<velocity_dimension,system> velocity;
+typedef unit<volume_dimension,system> volume;
/// unit constants
BOOST_UNITS_STATIC_CONSTANT(meter,length);
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk