Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65310 - sandbox/chrono/libs/chrono/test
From: vicente.botet_at_[hidden]
Date: 2010-09-05 15:47:18


Author: viboes
Date: 2010-09-05 15:47:17 EDT (Sun, 05 Sep 2010)
New Revision: 65310
URL: http://svn.boost.org/trac/boost/changeset/65310

Log:
delete moved files
Removed:
   sandbox/chrono/libs/chrono/test/common_type_fails.cpp
   sandbox/chrono/libs/chrono/test/common_type_test.cpp
   sandbox/chrono/libs/chrono/test/ratio_fail_test1.cpp
   sandbox/chrono/libs/chrono/test/ratio_test.cpp
Text files modified:
   sandbox/chrono/libs/chrono/test/Jamfile.v2 | 5 -----
   1 files changed, 0 insertions(+), 5 deletions(-)

Modified: sandbox/chrono/libs/chrono/test/Jamfile.v2
==============================================================================
--- sandbox/chrono/libs/chrono/test/Jamfile.v2 (original)
+++ sandbox/chrono/libs/chrono/test/Jamfile.v2 2010-09-05 15:47:17 EDT (Sun, 05 Sep 2010)
@@ -37,11 +37,6 @@
         <toolset>msvc:<cxxflags>/wd4127
     ;
 
- test-suite "common_type"
- :
- [ run common_type_test.cpp ]
- [ compile-fail common_type_fails.cpp ]
- ;
 
    test-suite "minmax"
         :

Deleted: sandbox/chrono/libs/chrono/test/common_type_fails.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/test/common_type_fails.cpp 2010-09-05 15:47:17 EDT (Sun, 05 Sep 2010)
+++ (empty file)
@@ -1,37 +0,0 @@
-// common_type_test.cpp ----------------------------------------------------//
-
-// Copyright 2010 Beman Dawes
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-#define _CRT_SECURE_NO_WARNINGS // disable VC++ foolishness
-
-#define STD2
-#ifndef STD
-#include <boost/type_traits/common_type.hpp>
-#else
-#include <type_traits>
-#endif
-#include <iostream>
-
-
-#include <boost/test/minimal.hpp>
-
-struct C1 {
- //~ private:
- //~ C1();
-};
-
-struct C2 {};
-
-
-
-#ifndef STD
-typedef boost::common_type<C1, C2>::type AC;
-#else
-typedef std::common_type<C1, C2>::type AC;
-#endif
-//~ AC* ac;
-
-
\ No newline at end of file

Deleted: sandbox/chrono/libs/chrono/test/common_type_test.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/test/common_type_test.cpp 2010-09-05 15:47:17 EDT (Sun, 05 Sep 2010)
+++ (empty file)
@@ -1,99 +0,0 @@
-// common_type_test.cpp ----------------------------------------------------//
-
-// Copyright 2010 Beman Dawes
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-#define _CRT_SECURE_NO_WARNINGS // disable VC++ foolishness
-
-#include <boost/type_traits/common_type.hpp>
-#include <iostream>
-
-#include <boost/test/minimal.hpp>
-
-struct C1 {};
-
-struct C2 {};
-
-
-struct C3 : C2 {};
-struct C1C2 {
- C1C2() {}
- C1C2(C1 const&) {}
- C1C2(C2 const&) {}
- C1C2& operator=(C1C2 const&) {
- return *this;
- }
-};
-
-template <typename C, typename A>
-void f2(typename boost::common_type<A, C>::type const& ) {}
-
-template <typename C, typename A, typename B>
-void f3(typename boost::common_type<C, A, B>::type const& ) {}
-
-template <typename C, typename A>
-void assignation_2() {
-typedef typename boost::common_type<A, C>::type AC;
- A a;
- C c;
- AC ac;
- ac=a;
- ac=c;
-
- f2<C, A>(a);
- f2<C, A>(c);
-
-}
-
-template <typename C, typename A, typename B>
-void assignation_3() {
-typedef typename boost::common_type<C, A, B>::type ABC;
- A a;
- B b;
- C c;
- ABC abc;
-
- abc=a;
- abc=b;
- abc=c;
-
- f3<C, A, B>(a);
- f3<C, A, B>(b);
- f3<C, A, B>(c);
-}
-
-C1C2 c1c2;
-C1 c1;
-
-int f(C1C2 ) { return 1;}
-int f(C1 ) { return 2;}
-template <typename OSTREAM>
-OSTREAM& operator<<(OSTREAM& os, C1 const&) {return os;}
-
-C1C2& declval_C1C2() {return c1c2;}
-C1& declval_C1(){return c1;}
-bool declval_bool(){return true;}
-
-int test_main( int /*argc*/, char * /*argv*/[] )
-{
- assignation_2<C1C2, C1>();
- typedef boost::common_type<C1C2&, C1&>::type T1; // fails if BOOST_COMMON_TYPE_DONT_USE_TYPEOF
- //~ std::cout << f(declval_bool()?declval_C1C2():declval_C1()) << std::endl;
- typedef boost::common_type<C3*, C2*>::type T2;
- typedef boost::common_type<int*, int const*>::type T3;
- typedef boost::common_type<int volatile*, int const*>::type T4; // fails if BOOST_COMMON_TYPE_DONT_USE_TYPEOF
- typedef boost::common_type<int*, int volatile*>::type T5;
- //~ typedef boost::common_type<short volatile*, int const*>::type T5; // fails
-
- assignation_2<C1, C1C2>();
- assignation_2<C1C2, C2>();
- assignation_2<C2, C1C2>();
- assignation_3<C1, C1C2, C2>();
- assignation_3<C1C2, C1, C2>();
- assignation_3<C2, C1C2, C1>();
- assignation_3<C1C2, C2, C1>();
- //~ assignation_3<C1, C2, C1C2>(); // fails because the common type is the third
- return 0;
-}

Deleted: sandbox/chrono/libs/chrono/test/ratio_fail_test1.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/test/ratio_fail_test1.cpp 2010-09-05 15:47:17 EDT (Sun, 05 Sep 2010)
+++ (empty file)
@@ -1,12 +0,0 @@
-// ratio_fail_test1.cpp ----------------------------------------------------//
-
-// Copyright 2008 Beman Dawes
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-#include <boost/ratio.hpp>
-
-typedef boost::ratio<BOOST_INTMAX_C(0x7FFFFFFFFFFFFFFF), BOOST_INTMAX_C(0x7FFFFFFFFFFFFFF0)> R1;
-typedef boost::ratio<BOOST_INTMAX_C(0x7FFFFFFFFFFFFFFE), BOOST_INTMAX_C(0x7FFFFFFFFFFFFFF0)> R2;
-typedef boost::ratio_multiply<R1, R2>::type RT;

Deleted: sandbox/chrono/libs/chrono/test/ratio_test.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/test/ratio_test.cpp 2010-09-05 15:47:17 EDT (Sun, 05 Sep 2010)
+++ (empty file)
@@ -1,259 +0,0 @@
-// ratio_test.cpp ----------------------------------------------------------//
-
-// Copyright 2008 Howard Hinnant
-// Copyright 2008 Beman Dawes
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-#include <boost/ratio.hpp>
-#include <boost/chrono/chrono.hpp>
-#include <iostream>
-#include <complex>
-
-template <class T, class U>
-typename boost::common_type<std::complex<T>, std::complex<U> >::type
-operator+(std::complex<T>, std::complex<U>);
-
-template <class T, class U>
-std::complex<typename boost::common_type<T, U>::type>
-operator-(std::complex<T>, std::complex<U>);
-
-typedef boost::ratio<5, 3> five_thirds; // five_thirds::num == 5, five_thirds::den == 3
-typedef boost::ratio<25, 15> also_five_thirds; // also_five_thirds::num == 5, also_five_thirds::den == 3
-typedef boost::ratio_divide<five_thirds, also_five_thirds>::type one; // one::num == 1, one::den == 1
-
-
-typedef boost::ratio_multiply<boost::ratio<5>, boost::giga>::type _5giga; // _5giga::num == 5000000000, _5giga::den == 1
-typedef boost::ratio_multiply<boost::ratio<5>, boost::nano>::type _5nano; // _5nano::num == 1, _5nano::den == 200000000
-
-// Test the case described in library working group issue 948.
-
-typedef boost::ratio<BOOST_INTMAX_C(0x7FFFFFFFFFFFFFFF), BOOST_INTMAX_C(0x7FFFFFFFFFFFFFF0)> R1;
-typedef boost::ratio<8, 7> R2;
-typedef boost::ratio_multiply<R1, R2>::type RT;
-
-//////////////////////////////////////////////////////////
-//////////////////// User1 Example ///////////////////////
-//////////////////////////////////////////////////////////
-
-namespace User1
-{
-// Example type-safe "physics" code interoperating with std::chrono::duration types
-// and taking advantage of the std::ratio infrastructure and design philosophy.
-
-// length - mimics std::chrono::duration except restricts representation to double.
-// Uses boost::ratio facilities for length units conversions.
-
-template <class Ratio>
-class length
-{
-public:
- typedef Ratio ratio;
-private:
- double len_;
-public:
-
- length() : len_(1) {}
- length(const double& len) : len_(len) {}
-
- // conversions
- template <class R>
- length(const length<R>& d)
- : len_(d.count() * boost::ratio_divide<Ratio, R>::type::den /
- boost::ratio_divide<Ratio, R>::type::num) {}
-
- // observer
-
- double count() const {return len_;}
-
- // arithmetic
-
- length& operator+=(const length& d) {len_ += d.count(); return *this;}
- length& operator-=(const length& d) {len_ -= d.count(); return *this;}
-
- length operator+() const {return *this;}
- length operator-() const {return length(-len_);}
-
- length& operator*=(double rhs) {len_ *= rhs; return *this;}
- length& operator/=(double rhs) {len_ /= rhs; return *this;}
-};
-
-// Sparse sampling of length units
-typedef length<boost::ratio<1> > meter; // set meter as "unity"
-typedef length<boost::centi> centimeter; // 1/100 meter
-typedef length<boost::kilo> kilometer; // 1000 meters
-typedef length<boost::ratio<254, 10000> > inch; // 254/10000 meters
-// length takes ratio instead of two integral types so that definitions can be made like so:
-typedef length<boost::ratio_multiply<boost::ratio<12>, inch::ratio>::type> foot; // 12 inchs
-typedef length<boost::ratio_multiply<boost::ratio<5280>, foot::ratio>::type> mile; // 5280 feet
-
-// Need a floating point definition of seconds
-typedef boost::chrono::duration<double> seconds; // unity
-// Demo of (scientific) support for sub-nanosecond resolutions
-typedef boost::chrono::duration<double, boost::pico> picosecond; // 10^-12 seconds
-typedef boost::chrono::duration<double, boost::femto> femtosecond; // 10^-15 seconds
-typedef boost::chrono::duration<double, boost::atto> attosecond; // 10^-18 seconds
-
-// A very brief proof-of-concept for SIUnits-like library
-// Hard-wired to floating point seconds and meters, but accepts other units (shown in testUser1())
-template <class R1, class R2>
-class quantity
-{
- double q_;
-public:
- typedef R1 time_dim;
- typedef R2 distance_dim;
- quantity() : q_(1) {}
-
- double get() const {return q_;}
- void set(double q) {q_ = q;}
-};
-
-template <>
-class quantity<boost::ratio<1>, boost::ratio<0> >
-{
- double q_;
-public:
- quantity() : q_(1) {}
- quantity(seconds d) : q_(d.count()) {} // note: only User1::seconds needed here
-
- double get() const {return q_;}
- void set(double q) {q_ = q;}
-};
-
-template <>
-class quantity<boost::ratio<0>, boost::ratio<1> >
-{
- double q_;
-public:
- quantity() : q_(1) {}
- quantity(meter d) : q_(d.count()) {} // note: only User1::meter needed here
-
- double get() const {return q_;}
- void set(double q) {q_ = q;}
-};
-
-template <>
-class quantity<boost::ratio<0>, boost::ratio<0> >
-{
- double q_;
-public:
- quantity() : q_(1) {}
- quantity(double d) : q_(d) {}
-
- double get() const {return q_;}
- void set(double q) {q_ = q;}
-};
-
-// Example SI-Units
-typedef quantity<boost::ratio<0>, boost::ratio<0> > Scalar;
-typedef quantity<boost::ratio<1>, boost::ratio<0> > Time; // second
-typedef quantity<boost::ratio<0>, boost::ratio<1> > Distance; // meter
-typedef quantity<boost::ratio<-1>, boost::ratio<1> > Speed; // meter/second
-typedef quantity<boost::ratio<-2>, boost::ratio<1> > Acceleration; // meter/second^2
-
-template <class R1, class R2, class R3, class R4>
-quantity<typename boost::ratio_subtract<R1, R3>::type, typename boost::ratio_subtract<R2, R4>::type>
-operator/(const quantity<R1, R2>& x, const quantity<R3, R4>& y)
-{
- typedef quantity<typename boost::ratio_subtract<R1, R3>::type, typename boost::ratio_subtract<R2, R4>::type> R;
- R r;
- r.set(x.get() / y.get());
- return r;
-}
-
-template <class R1, class R2, class R3, class R4>
-quantity<typename boost::ratio_add<R1, R3>::type, typename boost::ratio_add<R2, R4>::type>
-operator*(const quantity<R1, R2>& x, const quantity<R3, R4>& y)
-{
- typedef quantity<typename boost::ratio_add<R1, R3>::type, typename boost::ratio_add<R2, R4>::type> R;
- R r;
- r.set(x.get() * y.get());
- return r;
-}
-
-template <class R1, class R2>
-quantity<R1, R2>
-operator+(const quantity<R1, R2>& x, const quantity<R1, R2>& y)
-{
- typedef quantity<R1, R2> R;
- R r;
- r.set(x.get() + y.get());
- return r;
-}
-
-template <class R1, class R2>
-quantity<R1, R2>
-operator-(const quantity<R1, R2>& x, const quantity<R1, R2>& y)
-{
- typedef quantity<R1, R2> R;
- R r;
- r.set(x.get() - y.get());
- return r;
-}
-
-// Example type-safe physics function
-Distance
-compute_distance(Speed v0, Time t, Acceleration a)
-{
- return v0 * t + Scalar(.5) * a * t * t; // if a units mistake is made here it won't compile
-}
-
-} // User1
-
-// Exercise example type-safe physics function and show interoperation
-// of custom time durations (User1::seconds) and standard time durations (std::hours).
-// Though input can be arbitrary (but type-safe) units, output is always in SI-units
-// (a limitation of the simplified Units lib demoed here).
-
-
-
-int main()
-{
- typedef boost::ratio<8, BOOST_INTMAX_C(0x7FFFFFFFD)> R1;
- typedef boost::ratio<3, BOOST_INTMAX_C(0x7FFFFFFFD)> R2;
- typedef User1::quantity<boost::ratio_subtract<boost::ratio<0>, boost::ratio<1> >::type,
- boost::ratio_subtract<boost::ratio<1>, boost::ratio<0> >::type > RR;
- typedef boost::ratio_subtract<R1, R2>::type RS;
- std::cout << RS::num << '/' << RS::den << '\n';
-
-
- std::cout << "*************\n";
- std::cout << "* testUser1 *\n";
- std::cout << "*************\n";
- User1::Distance d( User1::mile(110) );
- User1::Time t(( boost::chrono::hours(2) ));
-
- //typedef User1::quantity<boost::ratio_subtract<User1::Distance::time_dim, User1::Time::time_dim >::type,
- // boost::ratio_subtract<User1::Distance::distance_dim, User1::Time::distance_dim >::type > R;
- RR r=d / t;
- //r.set(d.get() / t.get());
-
- User1::Speed rc= r;
-
- User1::Speed s = d / t;
- std::cout << "Speed = " << s.get() << " meters/sec\n";
- User1::Acceleration a = User1::Distance( User1::foot(32.2) ) / User1::Time() / User1::Time();
- std::cout << "Acceleration = " << a.get() << " meters/sec^2\n";
- User1::Distance df = compute_distance(s, User1::Time( User1::seconds(0.5) ), a);
- std::cout << "Distance = " << df.get() << " meters\n";
- std::cout << "There are " << User1::mile::ratio::den << '/' << User1::mile::ratio::num << " miles/meter";
- User1::meter mt = 1;
- User1::mile mi = mt;
- std::cout << " which is approximately " << mi.count() << '\n';
- std::cout << "There are " << User1::mile::ratio::num << '/' << User1::mile::ratio::den << " meters/mile";
- mi = 1;
- mt = mi;
- std::cout << " which is approximately " << mt.count() << '\n';
- User1::attosecond as(1);
- User1::seconds sec = as;
- std::cout << "1 attosecond is " << sec.count() << " seconds\n";
- std::cout << "sec = as; // compiles\n";
- sec = User1::seconds(1);
- as = sec;
- std::cout << "1 second is " << as.count() << " attoseconds\n";
- std::cout << "as = sec; // compiles\n";
- std::cout << "\n";
- return 0;
-}


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