Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65483 - in sandbox/chrono/libs/chrono/test: . traits traits/duration_values traits/is_fp traits/specializations
From: vicente.botet_at_[hidden]
Date: 2010-09-20 10:06:03


Author: viboes
Date: 2010-09-20 10:06:01 EDT (Mon, 20 Sep 2010)
New Revision: 65483
URL: http://svn.boost.org/trac/boost/changeset/65483

Log:
Adapt tests coming from llvm/libc++/test/chrono
Added:
   sandbox/chrono/libs/chrono/test/clock.h (contents, props changed)
   sandbox/chrono/libs/chrono/test/hours.pass.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/test/microseconds.pass.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/test/milliseconds.pass.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/test/minutes.pass.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/test/nanoseconds.pass.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/test/rep.h (contents, props changed)
   sandbox/chrono/libs/chrono/test/seconds.pass.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/test/traits/
   sandbox/chrono/libs/chrono/test/traits/duration_values/
   sandbox/chrono/libs/chrono/test/traits/duration_values/max.pass.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/test/traits/duration_values/min.pass.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/test/traits/duration_values/zero.pass.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/test/traits/is_fp/
   sandbox/chrono/libs/chrono/test/traits/is_fp/treat_as_floating_point.pass.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/test/traits/specializations/
   sandbox/chrono/libs/chrono/test/traits/specializations/duration.pass.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/test/traits/specializations/time_point.pass.cpp (contents, props changed)
Text files modified:
   sandbox/chrono/libs/chrono/test/Jamfile.v2 | 22 ++++++++++++++++++++++
   1 files changed, 22 insertions(+), 0 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-20 10:06:01 EDT (Mon, 20 Sep 2010)
@@ -29,6 +29,7 @@
         #<include>../../..
         <toolset>msvc:<asynch-exceptions>on
         <define>BOOST_ENABLE_WARNINGS
+ <define>BOOST_CHRONO_USES_MPL_ASSERT
         <warnings>all
         <toolset>gcc:<cxxflags>-Wextra
         <toolset>gcc:<cxxflags>-Wno-long-long
@@ -97,3 +98,24 @@
         [ run test_thread_clock.cpp : : : : test_thread_clock_dll ]
         ;
        
+ test-suite "typedefs"
+ :
+ [ run hours.pass.cpp : : : <link>static ]
+ [ run minutes.pass.cpp : : : <link>static ]
+ [ run seconds.pass.cpp : : : <link>static ]
+ [ run milliseconds.pass.cpp : : : <link>static ]
+ [ run microseconds.pass.cpp : : : <link>static ]
+ [ run nanoseconds.pass.cpp : : : <link>static ]
+ #[ run milliseconds.pass.cpp : : : : milliseconds.pass.dll ]
+ ;
+
+ test-suite "traits"
+ :
+ [ run traits/specializations/duration.pass.cpp : : : <link>static ]
+ [ run traits/specializations/time_point.pass.cpp : : : <link>static ]
+ [ run traits/is_fp/treat_as_floating_point.pass.cpp : : : <link>static ]
+ [ run traits/duration_values/max.pass.cpp : : : <link>static ]
+ [ run traits/duration_values/zero.pass.cpp : : : <link>static ]
+ [ run traits/duration_values/min.pass.cpp : : : <link>static ]
+ ;
+

Added: sandbox/chrono/libs/chrono/test/clock.h
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/clock.h 2010-09-20 10:06:01 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,17 @@
+#ifndef CLOCK_H
+#define CLOCK_H
+
+#include <boost/chrono.hpp>
+
+class Clock
+{
+ typedef std::chrono::nanoseconds duration;
+ typedef duration::rep rep;
+ typedef duration::period period;
+ typedef std::chrono::time_point<Clock, duration> time_point;
+ static const bool is_monotonic = false;
+
+ static time_point now();
+};
+
+#endif // CLOCK_H

Added: sandbox/chrono/libs/chrono/test/hours.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/hours.pass.cpp 2010-09-20 10:06:01 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+// Adapted by Vicente J. Botet Escriba test Boost.Chrono
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// typedef duration<signed integral type of at least 23 bits, ratio<3600>> hours;
+
+#include <boost/chrono.hpp>
+#include <boost/type_traits.hpp>
+#include <limits>
+
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+int main()
+{
+ typedef boost::chrono::hours D;
+ typedef D::rep Rep;
+ typedef D::period Period;
+ BOOST_CHRONO_STATIC_ASSERT(boost::is_signed<Rep>::value, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT(boost::is_integral<Rep>::value, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT(std::numeric_limits<Rep>::digits >= 22, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<Period, boost::ratio<3600> >::value), NOTHING, ());
+}

Added: sandbox/chrono/libs/chrono/test/microseconds.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/microseconds.pass.cpp 2010-09-20 10:06:01 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+// Adapted by Vicente J. Botet Escriba test Boost.Chrono
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// typedef duration<signed integral type of at least 55 bits, micro> microseconds;
+
+#include <boost/chrono.hpp>
+#include <boost/type_traits.hpp>
+#include <limits>
+
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+int main()
+{
+ typedef boost::chrono::microseconds D;
+ typedef D::rep Rep;
+ typedef D::period Period;
+ BOOST_CHRONO_STATIC_ASSERT(boost::is_signed<Rep>::value, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT(boost::is_integral<Rep>::value, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT(std::numeric_limits<Rep>::digits >= 54, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<Period, boost::micro>::value), NOTHING, ());
+}

Added: sandbox/chrono/libs/chrono/test/milliseconds.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/milliseconds.pass.cpp 2010-09-20 10:06:01 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+// Adapted by Vicente J. Botet Escriba test Boost.Chrono
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// typedef duration<signed integral type of at least 45 bits, milli> milliseconds;
+
+#include <boost/chrono.hpp>
+#include <boost/type_traits.hpp>
+#include <limits>
+
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+int main()
+{
+ typedef boost::chrono::milliseconds D;
+ typedef D::rep Rep;
+ typedef D::period Period;
+ BOOST_CHRONO_STATIC_ASSERT(boost::is_signed<Rep>::value, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT(boost::is_integral<Rep>::value, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT(std::numeric_limits<Rep>::digits >= 44, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<Period, boost::milli>::value), NOTHING, ());
+}

Added: sandbox/chrono/libs/chrono/test/minutes.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/minutes.pass.cpp 2010-09-20 10:06:01 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+// Adapted by Vicente J. Botet Escriba test Boost.Chrono
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// typedef duration<signed integral type of at least 29 bits, ratio< 60>> minutes;
+
+#include <boost/chrono.hpp>
+#include <boost/type_traits.hpp>
+#include <limits>
+
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+int main()
+{
+ typedef boost::chrono::minutes D;
+ typedef D::rep Rep;
+ typedef D::period Period;
+ BOOST_CHRONO_STATIC_ASSERT(boost::is_signed<Rep>::value, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT(boost::is_integral<Rep>::value, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT(std::numeric_limits<Rep>::digits >= 28, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<Period, boost::ratio<60> >::value), NOTHING, ());
+}

Added: sandbox/chrono/libs/chrono/test/nanoseconds.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/nanoseconds.pass.cpp 2010-09-20 10:06:01 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+// Adapted by Vicente J. Botet Escriba test Boost.Chrono
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// typedef duration<signed integral type of at least 64 bits, nano> nanoseconds;
+
+#include <boost/chrono.hpp>
+#include <boost/type_traits.hpp>
+#include <limits>
+
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+int main()
+{
+ typedef boost::chrono::nanoseconds D;
+ typedef D::rep Rep;
+ typedef D::period Period;
+ BOOST_CHRONO_STATIC_ASSERT(boost::is_signed<Rep>::value, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT(boost::is_integral<Rep>::value, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT(std::numeric_limits<Rep>::digits >= 63, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<Period, boost::nano>::value), NOTHING, ());
+}

Added: sandbox/chrono/libs/chrono/test/rep.h
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/rep.h 2010-09-20 10:06:01 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,18 @@
+#ifndef REP_H
+#define REP_H
+
+class Rep
+{
+public:
+ int data_;
+ Rep() : data_(-1) {}
+ explicit Rep(int i) : data_(i) {}
+
+ bool operator==(int i) const {return data_ == i;}
+ bool operator==(const Rep& r) const {return data_ == r.data_;}
+
+ Rep& operator*=(Rep x) {data_ *= x.data_; return *this;}
+ Rep& operator/=(Rep x) {data_ /= x.data_; return *this;}
+};
+
+#endif // REP_H

Added: sandbox/chrono/libs/chrono/test/seconds.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/seconds.pass.cpp 2010-09-20 10:06:01 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+// Adapted by Vicente J. Botet Escriba test Boost.Chrono
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// typedef duration<signed integral type of at least 35 bits > seconds;
+
+#include <boost/chrono.hpp>
+#include <boost/type_traits.hpp>
+#include <limits>
+
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+int main()
+{
+ typedef boost::chrono::seconds D;
+ typedef D::rep Rep;
+ typedef D::period Period;
+ BOOST_CHRONO_STATIC_ASSERT(boost::is_signed<Rep>::value, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT(boost::is_integral<Rep>::value, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT(std::numeric_limits<Rep>::digits >= 34, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<Period, boost::ratio<1> >::value), NOTHING, ());
+}

Added: sandbox/chrono/libs/chrono/test/traits/duration_values/max.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/traits/duration_values/max.pass.cpp 2010-09-20 10:06:01 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+// Adapted by Vicente J. Botet Escriba test Boost.Chrono
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration_values::max
+
+#include <boost/chrono.hpp>
+#include <boost/type_traits.hpp>
+#include <limits>
+#include <cassert>
+
+#include "../../rep.h"
+
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+int main()
+{
+ assert(boost::chrono::duration_values<int>::max() ==
+ std::numeric_limits<int>::max());
+ assert(boost::chrono::duration_values<double>::max() ==
+ std::numeric_limits<double>::max());
+ assert(boost::chrono::duration_values<Rep>::max() ==
+ std::numeric_limits<Rep>::max());
+}

Added: sandbox/chrono/libs/chrono/test/traits/duration_values/min.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/traits/duration_values/min.pass.cpp 2010-09-20 10:06:01 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+// Adapted by Vicente J. Botet Escriba test Boost.Chrono
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration_values::min
+
+#include <boost/chrono.hpp>
+#include <limits>
+#include <cassert>
+#include <iostream>
+
+#include "../../rep.h"
+
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+int main()
+{
+ assert(boost::chrono::duration_values<int>::min() ==
+ std::numeric_limits<int>::min());
+ assert(boost::chrono::duration_values<double>::min() ==
+ -std::numeric_limits<double>::max());
+ assert(boost::chrono::duration_values<Rep>::min() ==
+ std::numeric_limits<Rep>::min());
+
+ //~ std::cout << boost::chrono::duration_values<int>::min() << std::endl;
+ //~ std::cout << std::numeric_limits<int>::min() << std::endl;
+ //~ std::cout << std::numeric_limits<int>::lowest() << std::endl;
+ //~ std::cout << boost::chrono::duration_values<double>::min() << std::endl;
+ //~ std::cout << std::numeric_limits<double>::min() << std::endl;
+ //~ std::cout << -std::numeric_limits<double>::max() << std::endl;
+ //~ std::cout << std::numeric_limits<double>::lowest() << std::endl;
+ //~ std::cout << boost::chrono::duration_values<Rep>::max() << std::endl;
+ std::cout << (boost::chrono::duration_values<Rep>::min)().data_ << std::endl;
+ std::cout << (std::numeric_limits<Rep>::min)().data_ << std::endl;
+ std::cout << (std::numeric_limits<Rep>::max)().data_ << std::endl;
+ //~ std::numeric_limits<int>::min());
+ return 0;
+}

Added: sandbox/chrono/libs/chrono/test/traits/duration_values/zero.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/traits/duration_values/zero.pass.cpp 2010-09-20 10:06:01 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+// Adapted by Vicente J. Botet Escriba test Boost.Chrono
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration_values::zero
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+#include "../../rep.h"
+
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+int main()
+{
+ assert(boost::chrono::duration_values<int>::zero() == 0);
+ assert(boost::chrono::duration_values<Rep>::zero() == 0);
+}

Added: sandbox/chrono/libs/chrono/test/traits/is_fp/treat_as_floating_point.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/traits/is_fp/treat_as_floating_point.pass.cpp 2010-09-20 10:06:01 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+// Adapted by Vicente J. Botet Escriba test Boost.Chrono
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// treat_as_floating_point
+
+#include <boost/chrono.hpp>
+#include <boost/type_traits.hpp>
+
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+template <class T>
+void
+test()
+{
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_base_of<boost::is_floating_point<T>,
+ boost::chrono::treat_as_floating_point<T> >::value), NOTHING, ());
+}
+
+struct A {};
+
+int main()
+{
+ test<int>();
+ test<unsigned>();
+ test<char>();
+ test<bool>();
+ test<float>();
+ test<double>();
+ test<long double>();
+ test<A>();
+}

Added: sandbox/chrono/libs/chrono/test/traits/specializations/duration.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/traits/specializations/duration.pass.cpp 2010-09-20 10:06:01 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+// Adapted by Vicente J. Botet Escriba test Boost.Chrono
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// struct common_type<chrono::duration<Rep1, Period1>, chrono::duration<Rep2, Period2>>
+// {
+// typedef chrono::duration<typename common_type<Rep1, Rep2>::type, see below }> type;
+// };
+
+#include <boost/chrono.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+template <class D1, class D2, class De>
+void
+test()
+{
+ typedef typename boost::common_type<D1, D2>::type Dc;
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<Dc, De>::value), NOTHING, ());
+}
+
+int main()
+{
+ test<boost::chrono::duration<int, boost::ratio<1, 100> >,
+ boost::chrono::duration<long, boost::ratio<1, 1000> >,
+ boost::chrono::duration<long, boost::ratio<1, 1000> > >();
+ test<boost::chrono::duration<long, boost::ratio<1, 100> >,
+ boost::chrono::duration<int, boost::ratio<1, 1000> >,
+ boost::chrono::duration<long, boost::ratio<1, 1000> > >();
+ test<boost::chrono::duration<char, boost::ratio<1, 30> >,
+ boost::chrono::duration<short, boost::ratio<1, 1000> >,
+ boost::chrono::duration<int, boost::ratio<1, 3000> > >();
+ test<boost::chrono::duration<double, boost::ratio<21, 1> >,
+ boost::chrono::duration<short, boost::ratio<15, 1> >,
+ boost::chrono::duration<double, boost::ratio<3, 1> > >();
+}

Added: sandbox/chrono/libs/chrono/test/traits/specializations/time_point.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/traits/specializations/time_point.pass.cpp 2010-09-20 10:06:01 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+// Adapted by Vicente J. Botet Escriba test Boost.Chrono
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// template <class Clock, class Duration1, class Duration2>
+// struct common_type<chrono::time_point<Clock, Duration1>, chrono::time_point<Clock, Duration2>>
+// {
+// typedef chrono::time_point<Clock, typename common_type<Duration1, Duration2>::type> type;
+// };
+
+#include <boost/chrono.hpp>
+#include <boost/type_traits.hpp>
+
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+template <class D1, class D2, class De>
+void
+test()
+{
+ typedef boost::chrono::system_clock C;
+ typedef boost::chrono::time_point<C, D1> T1;
+ typedef boost::chrono::time_point<C, D2> T2;
+ typedef boost::chrono::time_point<C, De> Te;
+ typedef typename boost::common_type<T1, T2>::type Tc;
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<Tc, Te>::value), NOTHING, ());
+}
+
+int main()
+{
+ test<boost::chrono::duration<int, boost::ratio<1, 100> >,
+ boost::chrono::duration<long, boost::ratio<1, 1000> >,
+ boost::chrono::duration<long, boost::ratio<1, 1000> > >();
+ test<boost::chrono::duration<long, boost::ratio<1, 100> >,
+ boost::chrono::duration<int, boost::ratio<1, 1000> >,
+ boost::chrono::duration<long, boost::ratio<1, 1000> > >();
+ test<boost::chrono::duration<char, boost::ratio<1, 30> >,
+ boost::chrono::duration<short, boost::ratio<1, 1000> >,
+ boost::chrono::duration<int, boost::ratio<1, 3000> > >();
+ test<boost::chrono::duration<double, boost::ratio<21, 1> >,
+ boost::chrono::duration<short, boost::ratio<15, 1> >,
+ boost::chrono::duration<double, boost::ratio<3, 1> > >();
+}


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