|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r65486 - in sandbox/chrono/libs/chrono/test: . duration duration/arithmetic duration/cast duration/comparisons duration/cons duration/nonmember duration/observer duration/special
From: vicente.botet_at_[hidden]
Date: 2010-09-20 11:56:02
Author: viboes
Date: 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
New Revision: 65486
URL: http://svn.boost.org/trac/boost/changeset/65486
Log:
Adapt tests from llvm/libc++/test/chrono duration
Added:
sandbox/chrono/libs/chrono/test/duration/
sandbox/chrono/libs/chrono/test/duration/arithmetic/
sandbox/chrono/libs/chrono/test/duration/arithmetic/op_divide_ass.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/arithmetic/op_minus.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/arithmetic/op_minus_ass.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/arithmetic/op_minusminus.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/arithmetic/op_minusminusint.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/arithmetic/op_mod_ass_duration.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/arithmetic/op_mod_ass_rep.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/arithmetic/op_plus.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/arithmetic/op_plus_ass.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/arithmetic/op_plusplus.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/arithmetic/op_plusplusint.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/arithmetic/op_times_ass.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/cast/
sandbox/chrono/libs/chrono/test/duration/cast/duration_cast.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/cast/toduration.fail.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/comparisons/
sandbox/chrono/libs/chrono/test/duration/comparisons/op_equal.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/comparisons/op_less.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/cons/
sandbox/chrono/libs/chrono/test/duration/cons/convert_exact.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/cons/convert_float_to_int.fail.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/cons/convert_inexact.fail.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/cons/convert_inexact.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/cons/convert_int_to_float.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/cons/default.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/cons/rep.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/cons/rep01.fail.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/cons/rep02.fail.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/cons/rep02.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/cons/rep03.fail.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/default_ratio.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/duration.fail.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/nonmember/
sandbox/chrono/libs/chrono/test/duration/nonmember/op_divide_duration.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/nonmember/op_divide_rep.fail.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/nonmember/op_divide_rep.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/nonmember/op_minus.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/nonmember/op_mod_duration.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/nonmember/op_mod_rep.fail.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/nonmember/op_mod_rep.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/nonmember/op_plus.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/nonmember/op_times_rep.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/nonmember/op_times_rep1.fail.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/nonmember/op_times_rep2.fail.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/observer/
sandbox/chrono/libs/chrono/test/duration/observer/tested_elsewhere.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/positive_num.fail.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/ratio.fail.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/special/
sandbox/chrono/libs/chrono/test/duration/special/max.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/special/min.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/special/zero.pass.cpp (contents, props changed)
sandbox/chrono/libs/chrono/test/duration/types.pass.cpp (contents, props changed)
Text files modified:
sandbox/chrono/libs/chrono/test/Jamfile.v2 | 84 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 84 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 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -119,3 +119,87 @@
[ run traits/duration_values/min.pass.cpp : : : <link>static ]
;
+ test-suite "duration"
+ :
+ [ compile-fail duration/duration.fail.cpp ]
+ [ compile-fail duration/ratio.fail.cpp ]
+ [ compile-fail duration/positive_num.fail.cpp ]
+ [ run duration/default_ratio.pass.cpp : : : <link>static ]
+ [ run duration/types.pass.cpp : : : <link>static ]
+ [ run duration/arithmetic/op_divide_ass.pass.cpp : : : <link>static ]
+ [ run duration/arithmetic/op_minusminusint.pass.cpp : : : <link>static ]
+ [ run duration/arithmetic/op_plus_ass.pass.cpp : : : <link>static ]
+ [ run duration/arithmetic/op_minus.pass.cpp : : : <link>static ]
+ [ run duration/arithmetic/op_mod_ass_duration.pass.cpp : : : <link>static ]
+ [ run duration/arithmetic/op_plusplus.pass.cpp : : : <link>static ]
+ [ run duration/arithmetic/op_minus_ass.pass.cpp : : : <link>static ]
+ [ run duration/arithmetic/op_mod_ass_rep.pass.cpp : : : <link>static ]
+ [ run duration/arithmetic/op_plusplusint.pass.cpp : : : <link>static ]
+ [ run duration/arithmetic/op_minusminus.pass.cpp : : : <link>static ]
+ [ run duration/arithmetic/op_plus.pass.cpp : : : <link>static ]
+ [ run duration/arithmetic/op_times_ass.pass.cpp : : : <link>static ]
+ [ run duration/cast/duration_cast.pass.cpp : : : <link>static ]
+ [ compile-fail duration/cast/toduration.fail.cpp ]
+ [ run duration/comparisons/op_equal.pass.cpp : : : <link>static ]
+ [ run duration/comparisons/op_less.pass.cpp : : : <link>static ]
+
+ [ run duration/cons/convert_exact.pass.cpp : : : <link>static ]
+ [ compile-fail duration/cons/convert_float_to_int.fail.cpp ]
+ [ compile-fail duration/cons/convert_inexact.fail.cpp ]
+ [ run duration/cons/convert_inexact.pass.cpp : : : <link>static ]
+ [ run duration/cons/convert_int_to_float.pass.cpp : : : <link>static ]
+ [ run duration/cons/default.pass.cpp : : : <link>static ]
+ [ run duration/cons/rep.pass.cpp : : : <link>static ]
+ [ compile-fail duration/cons/rep01.fail.cpp ]
+ [ compile-fail duration/cons/rep02.fail.cpp ]
+ [ run duration/cons/rep02.pass.cpp : : : <link>static ]
+ [ compile-fail duration/cons/rep03.fail.cpp ]
+
+ [ run duration/nonmember/op_plus.pass.cpp : : : <link>static : nonmember_op_plus.pass ]
+ [ run duration/nonmember/op_minus.pass.cpp : : : <link>static : nonmember_op_minus.pass ]
+ [ run duration/nonmember/op_divide_duration.pass.cpp : : : <link>static : nonmember_op_divide_duration.pass ]
+ [ compile-fail duration/nonmember/op_divide_rep.fail.cpp : : nonmember_op_divide_rep.fail ]
+ [ run duration/nonmember/op_divide_rep.pass.cpp : : : <link>static : nonmember_op_divide_rep.pass ]
+ [ run duration/nonmember/op_mod_duration.pass.cpp : : : <link>static : nonmember_op_mod_duration.pass ]
+ [ run duration/nonmember/op_mod_rep.pass.cpp : : : <link>static : nonmember_op_mod_rep.pass ]
+ [ compile-fail duration/nonmember/op_mod_rep.fail.cpp : : nonmember_op_mod_rep.fail ]
+ [ run duration/nonmember/op_times_rep.pass.cpp : : : <link>static : nonmember_op_times_rep.pass ]
+ [ compile-fail duration/nonmember/op_times_rep1.fail.cpp : : nonmember_op_times_rep1.fail ]
+ [ compile-fail duration/nonmember/op_times_rep2.fail.cpp : : nonmember_op_times_rep2.fail ]
+
+ [ run duration/special/max.pass.cpp : : : <link>static : duration_special_max.pass ]
+ [ run duration/special/min.pass.cpp : : : <link>static : duration_special_min.pass ]
+ [ run duration/special/zero.pass.cpp : : : <link>static : duration_special_zero.pass ]
+ ;
+
+
+
+#time_point/arithmetic/op_+=.pass.cpp
+#time_point/arithmetic/op_-=.pass.cpp
+#time_point/cast/time_point_cast.pass.cpp
+#time_point/cast/toduration.fail.cpp
+#time_point/comparisons/op_equal.fail.cpp
+#time_point/comparisons/op_equal.pass.cpp
+#time_point/comparisons/op_less.fail.cpp
+#time_point/comparisons/op_less.pass.cpp
+#time_point/cons/convert.fail.cpp
+#time_point/cons/convert.pass.cpp
+#time_point/cons/default.pass.cpp
+#time_point/cons/duration.fail.cpp
+#time_point/cons/duration.pass.cpp
+#time_point/nonmember/op_+.pass.cpp
+#time_point/nonmember/op_-duration.pass.cpp
+#time_point/nonmember/op_-time_point.pass.cpp
+#time_point/observer/tested_elsewhere.pass.cpp
+#time_point/special/max.pass.cpp
+#time_point/special/min.pass.cpp
+#clock/hires/consistency.pass.cpp
+#clock/hires/now.pass.cpp
+#clock/monotonic/consistency.pass.cpp
+#clock/monotonic/now.pass.cpp
+#clock/system/consistency.pass.cpp
+#clock/system/from_time_t.pass.cpp
+#clock/system/now.pass.cpp
+#clock/system/rep_signed.pass.cpp
+#clock/system/to_time_t.pass.cpp
+
Added: sandbox/chrono/libs/chrono/test/duration/arithmetic/op_divide_ass.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/arithmetic/op_divide_ass.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// duration& operator/=(const rep& rhs);
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ boost::chrono::nanoseconds ns(15);
+ ns /= 5;
+ assert(ns.count() == 3);
+}
Added: sandbox/chrono/libs/chrono/test/duration/arithmetic/op_minus.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/arithmetic/op_minus.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// duration operator-() const;
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ const boost::chrono::minutes m(3);
+ boost::chrono::minutes m2 = -m;
+ assert(m2.count() == -m.count());
+}
Added: sandbox/chrono/libs/chrono/test/duration/arithmetic/op_minus_ass.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/arithmetic/op_minus_ass.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// duration& operator-=(const duration& d);
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ boost::chrono::seconds s(3);
+ s -= boost::chrono::seconds(2);
+ assert(s.count() == 1);
+ s -= boost::chrono::minutes(2);
+ assert(s.count() == -119);
+}
Added: sandbox/chrono/libs/chrono/test/duration/arithmetic/op_minusminus.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/arithmetic/op_minusminus.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,28 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// duration& operator--();
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ boost::chrono::hours h(3);
+ boost::chrono::hours& href = --h;
+ assert(&href == &h);
+ assert(h.count() == 2);
+}
Added: sandbox/chrono/libs/chrono/test/duration/arithmetic/op_minusminusint.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/arithmetic/op_minusminusint.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// duration operator--(int);
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ boost::chrono::hours h(3);
+ boost::chrono::hours h2 = h--;
+ assert(h.count() == 2);
+ assert(h2.count() == 3);
+}
Added: sandbox/chrono/libs/chrono/test/duration/arithmetic/op_mod_ass_duration.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/arithmetic/op_mod_ass_duration.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// duration& operator%=(const duration& rhs)
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ boost::chrono::microseconds us(11);
+ boost::chrono::microseconds us2(3);
+ us %= us2;
+ assert(us.count() == 2);
+ us %= boost::chrono::milliseconds(3);
+ assert(us.count() == 2);
+}
Added: sandbox/chrono/libs/chrono/test/duration/arithmetic/op_mod_ass_rep.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/arithmetic/op_mod_ass_rep.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// duration& operator%=(const rep& rhs)
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ boost::chrono::microseconds us(11);
+ us %= 3;
+ assert(us.count() == 2);
+}
Added: sandbox/chrono/libs/chrono/test/duration/arithmetic/op_plus.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/arithmetic/op_plus.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// duration operator+() const;
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ const boost::chrono::minutes m(3);
+ boost::chrono::minutes m2 = +m;
+ assert(m.count() == m2.count());
+}
Added: sandbox/chrono/libs/chrono/test/duration/arithmetic/op_plus_ass.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/arithmetic/op_plus_ass.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// duration& operator+=(const duration& d);
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ boost::chrono::seconds s(3);
+ s += boost::chrono::seconds(2);
+ assert(s.count() == 5);
+ s += boost::chrono::minutes(2);
+ assert(s.count() == 125);
+}
Added: sandbox/chrono/libs/chrono/test/duration/arithmetic/op_plusplus.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/arithmetic/op_plusplus.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// duration& operator++();
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ boost::chrono::hours h(3);
+ boost::chrono::hours& href = ++h;
+ assert(&href == &h);
+ assert(h.count() == 4);
+}
Added: sandbox/chrono/libs/chrono/test/duration/arithmetic/op_plusplusint.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/arithmetic/op_plusplusint.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// duration operator++(int);
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ boost::chrono::hours h(3);
+ boost::chrono::hours h2 = h++;
+ assert(h.count() == 4);
+ assert(h2.count() == 3);
+}
Added: sandbox/chrono/libs/chrono/test/duration/arithmetic/op_times_ass.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/arithmetic/op_times_ass.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// duration& operator*=(const rep& rhs);
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ boost::chrono::nanoseconds ns(3);
+ ns *= 5;
+ assert(ns.count() == 15);
+}
Added: sandbox/chrono/libs/chrono/test/duration/cast/duration_cast.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/cast/duration_cast.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class ToDuration, class Rep, class Period>
+// ToDuration
+// duration_cast(const duration<Rep, Period>& d);
+
+#include <boost/chrono.hpp>
+#include <boost/type_traits.hpp>
+#include <cassert>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+template <class ToDuration, class FromDuration>
+void
+test(const FromDuration& f, const ToDuration& d)
+{
+#if defined(BOOST_NO_DECLTYPE)
+ typedef BOOST_TYPEOF_TPL(boost::chrono::duration_cast<ToDuration>(f)) R;
+#else
+ typedef decltype(boost::chrono::duration_cast<ToDuration>(f)) R;
+#endif
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<R, ToDuration>::value), NOTHING, ());
+ assert(boost::chrono::duration_cast<ToDuration>(f) == d);
+}
+
+int main()
+{
+ test(boost::chrono::milliseconds(7265000), boost::chrono::hours(2));
+ test(boost::chrono::milliseconds(7265000), boost::chrono::minutes(121));
+ test(boost::chrono::milliseconds(7265000), boost::chrono::seconds(7265));
+ test(boost::chrono::milliseconds(7265000), boost::chrono::milliseconds(7265000));
+ test(boost::chrono::milliseconds(7265000), boost::chrono::microseconds(7265000000LL));
+ test(boost::chrono::milliseconds(7265000), boost::chrono::nanoseconds(7265000000000LL));
+ test(boost::chrono::milliseconds(7265000),
+ boost::chrono::duration<double, boost::ratio<3600> >(7265./3600));
+ test(boost::chrono::duration<int, boost::ratio<2, 3> >(9),
+ boost::chrono::duration<int, boost::ratio<3, 5> >(10));
+}
Added: sandbox/chrono/libs/chrono/test/duration/cast/toduration.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/cast/toduration.fail.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class ToDuration, class Rep, class Period>
+// ToDuration
+// duration_cast(const duration<Rep, Period>& d);
+
+// ToDuration shall be an instantiation of duration.
+
+#include <boost/chrono.hpp>
+
+int main()
+{
+ boost::chrono::duration_cast<int>(boost::chrono::milliseconds(3));
+}
Added: sandbox/chrono/libs/chrono/test/duration/comparisons/op_equal.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/comparisons/op_equal.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,72 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// bool
+// operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// bool
+// operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::seconds s2(3);
+ assert(s1 == s2);
+ assert(!(s1 != s2));
+ }
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::seconds s2(4);
+ assert(!(s1 == s2));
+ assert(s1 != s2);
+ }
+ {
+ boost::chrono::milliseconds s1(3);
+ boost::chrono::microseconds s2(3000);
+ assert(s1 == s2);
+ assert(!(s1 != s2));
+ }
+ {
+ boost::chrono::milliseconds s1(3);
+ boost::chrono::microseconds s2(4000);
+ assert(!(s1 == s2));
+ assert(s1 != s2);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(10);
+ assert(s1 == s2);
+ assert(!(s1 != s2));
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(10);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(9);
+ assert(!(s1 == s2));
+ assert(s1 != s2);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ boost::chrono::duration<double, boost::ratio<3, 5> > s2(10);
+ assert(s1 == s2);
+ assert(!(s1 != s2));
+ }
+}
Added: sandbox/chrono/libs/chrono/test/duration/comparisons/op_less.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/comparisons/op_less.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,94 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// bool
+// operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// bool
+// operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// bool
+// operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// bool
+// operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::seconds s2(3);
+ assert(!(s1 < s2));
+ assert(!(s1 > s2));
+ assert( (s1 <= s2));
+ assert( (s1 >= s2));
+ }
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::seconds s2(4);
+ assert( (s1 < s2));
+ assert(!(s1 > s2));
+ assert( (s1 <= s2));
+ assert(!(s1 >= s2));
+ }
+ {
+ boost::chrono::milliseconds s1(3);
+ boost::chrono::microseconds s2(3000);
+ assert(!(s1 < s2));
+ assert(!(s1 > s2));
+ assert( (s1 <= s2));
+ assert( (s1 >= s2));
+ }
+ {
+ boost::chrono::milliseconds s1(3);
+ boost::chrono::microseconds s2(4000);
+ assert( (s1 < s2));
+ assert(!(s1 > s2));
+ assert( (s1 <= s2));
+ assert(!(s1 >= s2));
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(10);
+ assert(!(s1 < s2));
+ assert(!(s1 > s2));
+ assert( (s1 <= s2));
+ assert( (s1 >= s2));
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(10);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(9);
+ assert(!(s1 < s2));
+ assert( (s1 > s2));
+ assert(!(s1 <= s2));
+ assert( (s1 >= s2));
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ boost::chrono::duration<double, boost::ratio<3, 5> > s2(10);
+ assert(!(s1 < s2));
+ assert(!(s1 > s2));
+ assert( (s1 <= s2));
+ assert( (s1 >= s2));
+ }
+}
Added: sandbox/chrono/libs/chrono/test/duration/cons/convert_exact.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/cons/convert_exact.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,30 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep2, class Period2>
+// duration(const duration<Rep2, Period2>& d);
+
+// exact conversions allowed for integral reps
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ boost::chrono::milliseconds ms(1);
+ boost::chrono::microseconds us = ms;
+ assert(us.count() == 1000);
+}
Added: sandbox/chrono/libs/chrono/test/duration/cons/convert_float_to_int.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/cons/convert_float_to_int.fail.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep2, class Period2>
+// duration(const duration<Rep2, Period2>& d);
+
+// conversions from floating point to integral durations disallowed
+
+#include <boost/chrono.hpp>
+
+int main()
+{
+ boost::chrono::duration<double> d;
+ boost::chrono::duration<int> i = d;
+}
Added: sandbox/chrono/libs/chrono/test/duration/cons/convert_inexact.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/cons/convert_inexact.fail.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,30 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep2, class Period2>
+// duration(const duration<Rep2, Period2>& d);
+
+// inexact conversions disallowed for integral reps
+
+#include <boost/chrono.hpp>
+
+int main()
+{
+ boost::chrono::microseconds us(1);
+ boost::chrono::milliseconds ms = us;
+}
Added: sandbox/chrono/libs/chrono/test/duration/cons/convert_inexact.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/cons/convert_inexact.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,30 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep2, class Period2>
+// duration(const duration<Rep2, Period2>& d);
+
+// inexact conversions allowed for floating point reps
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ boost::chrono::duration<double, boost::micro> us(1);
+ boost::chrono::duration<double, boost::milli> ms = us;
+ assert(ms.count() == 1./1000);
+}
Added: sandbox/chrono/libs/chrono/test/duration/cons/convert_int_to_float.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/cons/convert_int_to_float.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,30 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep2, class Period2>
+// duration(const duration<Rep2, Period2>& d);
+
+// conversions from integral to floating point durations allowed
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ boost::chrono::duration<int> i(3);
+ boost::chrono::duration<int> d = i;
+ assert(d.count() == 3);
+}
Added: sandbox/chrono/libs/chrono/test/duration/cons/default.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/cons/default.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,37 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// duration() = default;
+
+// Rep must be default initialized, not initialized with 0
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+#include "../../rep.h"
+
+template <class D>
+void
+test()
+{
+ D d;
+ assert(d.count() == typename D::rep());
+}
+
+int main()
+{
+ test<boost::chrono::duration<Rep> >();
+}
Added: sandbox/chrono/libs/chrono/test/duration/cons/rep.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/cons/rep.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,39 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep2>
+// explicit duration(const Rep2& r);
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+#include "../../rep.h"
+
+template <class D, class R>
+void
+test(R r)
+{
+ D d(r);
+ assert(d.count() == r);
+}
+
+int main()
+{
+ test<boost::chrono::duration<int> >(5);
+ test<boost::chrono::duration<int, boost::ratio<3, 2> > >(5);
+ test<boost::chrono::duration<Rep, boost::ratio<3, 2> > >(Rep(3));
+ test<boost::chrono::duration<double, boost::ratio<2, 3> > >(5.5);
+}
Added: sandbox/chrono/libs/chrono/test/duration/cons/rep01.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/cons/rep01.fail.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,29 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep2>
+// explicit duration(const Rep2& r);
+
+// test for explicit
+
+#include <boost/chrono.hpp>
+
+#include "../../rep.h"
+
+int main()
+{
+ boost::chrono::duration<int> d = 1;
+}
Added: sandbox/chrono/libs/chrono/test/duration/cons/rep02.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/cons/rep02.fail.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,29 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep2>
+// explicit duration(const Rep2& r);
+
+// Rep2 shall be implicitly convertible to rep
+
+#include <boost/chrono.hpp>
+
+#include "../../rep.h"
+
+int main()
+{
+ boost::chrono::duration<Rep> d(1);
+}
Added: sandbox/chrono/libs/chrono/test/duration/cons/rep02.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/cons/rep02.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,29 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep2>
+// explicit duration(const Rep2& r);
+
+// construct double with int
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ boost::chrono::duration<double> d(5);
+ assert(d.count() == 5);
+}
Added: sandbox/chrono/libs/chrono/test/duration/cons/rep03.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/cons/rep03.fail.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,27 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep2>
+// explicit duration(const Rep2& r);
+
+// treat_as_floating_point<Rep2>::value shall be false
+
+#include <boost/chrono.hpp>
+
+int main()
+{
+ boost::chrono::duration<int> d(1.);
+}
Added: sandbox/chrono/libs/chrono/test/duration/default_ratio.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/default_ratio.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,34 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// Test default template arg:
+
+// template <class Rep, class Period = ratio<1>>
+// class duration;
+
+#include <boost/chrono.hpp>
+#include <boost/type_traits.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+int main()
+{
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<boost::chrono::duration<int, boost::ratio<1> >,
+ boost::chrono::duration<int> >::value), NOTHING, ());
+}
Added: sandbox/chrono/libs/chrono/test/duration/duration.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/duration.fail.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,26 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// If a program instantiates duration with a duration type for the template
+// argument Rep a diagnostic is required.
+
+#include <boost/chrono.hpp>
+
+int main()
+{
+ typedef boost::chrono::duration<boost::chrono::milliseconds> D;
+ D d;
+}
Added: sandbox/chrono/libs/chrono/test/duration/nonmember/op_divide_duration.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/nonmember/op_divide_duration.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,46 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// typename common_type<Rep1, Rep2>::type
+// operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ {
+ boost::chrono::nanoseconds ns1(15);
+ boost::chrono::nanoseconds ns2(5);
+ assert(ns1 / ns2 == 3);
+ }
+ {
+ boost::chrono::microseconds us1(15);
+ boost::chrono::nanoseconds ns2(5);
+ assert(us1 / ns2 == 3000);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(30);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(5);
+ assert(s1 / s2 == 6);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(30);
+ boost::chrono::duration<double, boost::ratio<3, 5> > s2(5);
+ assert(s1 / s2 == 20./3);
+ }
+}
Added: sandbox/chrono/libs/chrono/test/duration/nonmember/op_divide_rep.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/nonmember/op_divide_rep.fail.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,29 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
+// operator/(const duration<Rep1, Period>& d, const Rep2& s);
+
+#include <boost/chrono.hpp>
+
+#include "../../rep.h"
+
+int main()
+{
+ boost::chrono::duration<Rep> d(Rep(15));
+ d = d / 5;
+}
Added: sandbox/chrono/libs/chrono/test/duration/nonmember/op_divide_rep.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/nonmember/op_divide_rep.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,29 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
+// operator/(const duration<Rep1, Period>& d, const Rep2& s);
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ boost::chrono::nanoseconds ns(15);
+ ns = ns / 5;
+ assert(ns.count() == 3);
+}
Added: sandbox/chrono/libs/chrono/test/duration/nonmember/op_minus.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/nonmember/op_minus.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,52 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
+// operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::seconds s2(5);
+ boost::chrono::seconds r = s1 - s2;
+ assert(r.count() == -2);
+ }
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::microseconds s2(5);
+ boost::chrono::microseconds r = s1 - s2;
+ assert(r.count() == 2999995);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(5);
+ boost::chrono::duration<int, boost::ratio<1, 15> > r = s1 - s2;
+ assert(r.count() == -15);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ boost::chrono::duration<double, boost::ratio<3, 5> > s2(5);
+ boost::chrono::duration<double, boost::ratio<1, 15> > r = s1 - s2;
+ assert(r.count() == -15);
+ }
+}
Added: sandbox/chrono/libs/chrono/test/duration/nonmember/op_mod_duration.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/nonmember/op_mod_duration.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,44 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
+// operator%(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ {
+ boost::chrono::nanoseconds ns1(15);
+ boost::chrono::nanoseconds ns2(6);
+ boost::chrono::nanoseconds r = ns1 % ns2;
+ assert(r.count() == 3);
+ }
+ {
+ boost::chrono::microseconds us1(15);
+ boost::chrono::nanoseconds ns2(28);
+ boost::chrono::nanoseconds r = us1 % ns2;
+ assert(r.count() == 20);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<3, 5> > s1(6);
+ boost::chrono::duration<int, boost::ratio<2, 3> > s2(3);
+ boost::chrono::duration<int, boost::ratio<1, 15> > r = s1 % s2;
+ assert(r.count() == 24);
+ }
+}
Added: sandbox/chrono/libs/chrono/test/duration/nonmember/op_mod_rep.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/nonmember/op_mod_rep.fail.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,29 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
+// operator%(const duration<Rep1, Period>& d, const Rep2& s)
+
+#include <boost/chrono.hpp>
+
+#include "../../rep.h"
+
+int main()
+{
+ boost::chrono::duration<Rep> d(Rep(15));
+ d = d % 5;
+}
Added: sandbox/chrono/libs/chrono/test/duration/nonmember/op_mod_rep.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/nonmember/op_mod_rep.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,29 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
+// operator%(const duration<Rep1, Period>& d, const Rep2& s)
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ boost::chrono::nanoseconds ns(15);
+ ns = ns % 6;
+ assert(ns.count() == 3);
+}
Added: sandbox/chrono/libs/chrono/test/duration/nonmember/op_plus.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/nonmember/op_plus.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,52 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// duration
+
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
+// operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::seconds s2(5);
+ boost::chrono::seconds r = s1 + s2;
+ assert(r.count() == 8);
+ }
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::microseconds s2(5);
+ boost::chrono::microseconds r = s1 + s2;
+ assert(r.count() == 3000005);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(5);
+ boost::chrono::duration<int, boost::ratio<1, 15> > r = s1 + s2;
+ assert(r.count() == 75);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ boost::chrono::duration<double, boost::ratio<3, 5> > s2(5);
+ boost::chrono::duration<double, boost::ratio<1, 15> > r = s1 + s2;
+ assert(r.count() == 75);
+ }
+}
Added: sandbox/chrono/libs/chrono/test/duration/nonmember/op_times_rep.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/nonmember/op_times_rep.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,35 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
+// operator*(const duration<Rep1, Period>& d, const Rep2& s);
+
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
+// operator*(const Rep1& s, const duration<Rep2, Period>& d);
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+int main()
+{
+ boost::chrono::nanoseconds ns(3);
+ ns = ns * 5;
+ assert(ns.count() == 15);
+ ns = 6 * ns;
+ assert(ns.count() == 90);
+}
Added: sandbox/chrono/libs/chrono/test/duration/nonmember/op_times_rep1.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/nonmember/op_times_rep1.fail.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,33 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
+// operator*(const duration<Rep1, Period>& d, const Rep2& s);
+
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
+// operator*(const Rep1& s, const duration<Rep2, Period>& d);
+
+#include <boost/chrono.hpp>
+
+#include "../../rep.h"
+
+int main()
+{
+ boost::chrono::duration<Rep> d;
+ d = d * 5;
+}
Added: sandbox/chrono/libs/chrono/test/duration/nonmember/op_times_rep2.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/nonmember/op_times_rep2.fail.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,33 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
+// operator*(const duration<Rep1, Period>& d, const Rep2& s);
+
+// template <class Rep1, class Period, class Rep2>
+// duration<typename common_type<Rep1, Rep2>::type, Period>
+// operator*(const Rep1& s, const duration<Rep2, Period>& d);
+
+#include <boost/chrono.hpp>
+
+#include "../../rep.h"
+
+int main()
+{
+ boost::chrono::duration<Rep> d;
+ d = 5 * d;
+}
Added: sandbox/chrono/libs/chrono/test/duration/observer/tested_elsewhere.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/observer/tested_elsewhere.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,17 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Added: sandbox/chrono/libs/chrono/test/duration/positive_num.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/positive_num.fail.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,25 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// Period::num shall be positive, diagnostic required.
+
+#include <boost/chrono.hpp>
+
+int main()
+{
+ typedef boost::chrono::duration<int, boost::ratio<5, -1> > D;
+ D d;
+}
Added: sandbox/chrono/libs/chrono/test/duration/ratio.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/ratio.fail.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,33 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// Period shall be a specialization of ratio, diagnostic required.
+
+#include <boost/chrono.hpp>
+
+template <int N, int D = 1>
+class Ratio
+{
+public:
+ static const int num = N;
+ static const int den = D;
+};
+
+int main()
+{
+ typedef boost::chrono::duration<int, Ratio<1> > D;
+ D d;
+}
Added: sandbox/chrono/libs/chrono/test/duration/special/max.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/special/max.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,37 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// static constexpr duration max();
+
+#include <boost/chrono.hpp>
+#include <limits>
+#include <cassert>
+
+#include "../../rep.h"
+
+template <class D>
+void test()
+{
+ typedef typename D::rep Rep;
+ Rep max_rep = boost::chrono::duration_values<Rep>::max();
+ assert(D::max().count() == max_rep);
+}
+
+int main()
+{
+ test<boost::chrono::duration<int> >();
+ test<boost::chrono::duration<Rep> >();
+}
Added: sandbox/chrono/libs/chrono/test/duration/special/min.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/special/min.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,37 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// static constexpr duration min();
+
+#include <boost/chrono.hpp>
+#include <boost/limits.hpp>
+#include <cassert>
+
+#include "../../rep.h"
+
+template <class D>
+void test()
+{
+ typedef typename D::rep Rep;
+ Rep min_rep = boost::chrono::duration_values<Rep>::min();
+ assert(D::min().count() == min_rep);
+}
+
+int main()
+{
+ test<boost::chrono::duration<int> >();
+ test<boost::chrono::duration<Rep> >();
+}
Added: sandbox/chrono/libs/chrono/test/duration/special/zero.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/special/zero.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,36 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// static constexpr duration zero();
+
+#include <boost/chrono.hpp>
+#include <cassert>
+
+#include "../../rep.h"
+
+template <class D>
+void test()
+{
+ typedef typename D::rep Rep;
+ Rep zero_rep = boost::chrono::duration_values<Rep>::zero();
+ assert(D::zero().count() == zero_rep);
+}
+
+int main()
+{
+ test<boost::chrono::duration<int> >();
+ test<boost::chrono::duration<Rep> >();
+}
Added: sandbox/chrono/libs/chrono/test/duration/types.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/test/duration/types.pass.cpp 2010-09-20 11:55:57 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,33 @@
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted from llvm/libcxx/test/utilities/chrono
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// duration
+
+// Test nested types
+
+// typedef Rep rep;
+// typedef Period period;
+
+#include <boost/chrono.hpp>
+#include <boost/type_traits.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+int main()
+{
+ typedef boost::chrono::duration<long, boost::ratio<3, 2> > D;
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<D::rep, long>::value), NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<D::period, boost::ratio<3, 2> >::value), NOTHING, ());
+}
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