Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67319 - in sandbox/chrono/libs/ratio/test: . ratio_arithmetic ratio_comparison ratio_io ratio_ratio
From: vicente.botet_at_[hidden]
Date: 2010-12-19 05:43:13


Author: viboes
Date: 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
New Revision: 67319
URL: http://svn.boost.org/trac/boost/changeset/67319

Log:
Ratio: Add adapted ratio test from libcxx

Added:
   sandbox/chrono/libs/ratio/test/ratio_arithmetic/
   sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_add_2_fail.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_add_3_fail.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_add_fail.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_add_pass.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_divide_fail.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_divide_pass.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_multiply_fail.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_multiply_pass.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_subtract_fail.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_subtract_pass.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_comparison/
   sandbox/chrono/libs/ratio/test/ratio_comparison/ratio_equal_pass.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_comparison/ratio_greater_equal_pass.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_comparison/ratio_greater_pass.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_comparison/ratio_less_equal_pass.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_comparison/ratio_less_pass.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_comparison/ratio_not_equal_pass.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_io/
   sandbox/chrono/libs/ratio/test/ratio_io/ratio_io_fail.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_io/ratio_io_pass.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_ratio/
   sandbox/chrono/libs/ratio/test/ratio_ratio/ratio1_fail.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_ratio/ratio2_fail.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_ratio/ratio3_fail.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_ratio/ratio4_fail.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/ratio_ratio/ratio_pass.cpp (contents, props changed)
   sandbox/chrono/libs/ratio/test/typedefs_pass.cpp (contents, props changed)
Text files modified:
   sandbox/chrono/libs/ratio/test/Jamfile.v2 | 39 +++++++++++++++++++++++++++++++++++++--
   1 files changed, 37 insertions(+), 2 deletions(-)

Modified: sandbox/chrono/libs/ratio/test/Jamfile.v2
==============================================================================
--- sandbox/chrono/libs/ratio/test/Jamfile.v2 (original)
+++ sandbox/chrono/libs/ratio/test/Jamfile.v2 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -34,9 +34,44 @@
         <toolset>msvc:<cxxflags>/wd4127
     ;
 
- test-suite "ratio"
+ test-suite "ratio.ratio"
         :
- [ run ratio_test.cpp ]
+ [ compile typedefs_pass.cpp ]
+ [ compile ratio_ratio/ratio_pass.cpp ]
+ [ compile-fail ratio_ratio/ratio1_fail.cpp ]
+ [ compile-fail ratio_ratio/ratio2_fail.cpp ]
+ [ compile-fail ratio_ratio/ratio3_fail.cpp ]
+ [ compile-fail ratio_ratio/ratio4_fail.cpp ]
+ ;
+
+ test-suite "ratio_io"
+ :
+ [ compile-fail ratio_io/ratio_io_fail.cpp ]
+ [ run ratio_io/ratio_io_pass.cpp ]
+ ;
+
+ test-suite "ratio.arithmetic"
+ :
+ [ compile ratio_arithmetic/ratio_add_pass.cpp ]
+ [ compile ratio_arithmetic/ratio_subtract_pass.cpp ]
+ [ compile ratio_arithmetic/ratio_multiply_pass.cpp ]
+ [ compile ratio_arithmetic/ratio_divide_pass.cpp ]
+ [ compile-fail ratio_arithmetic/ratio_add_fail.cpp ]
+ [ compile-fail ratio_arithmetic/ratio_add_2_fail.cpp ]
+ [ compile-fail ratio_arithmetic/ratio_add_3_fail.cpp ]
+ [ compile-fail ratio_arithmetic/ratio_subtract_fail.cpp ]
+ [ compile-fail ratio_arithmetic/ratio_multiply_fail.cpp ]
+ [ compile-fail ratio_arithmetic/ratio_divide_fail.cpp ]
+ ;
+
+ test-suite "ratio.comparison"
+ :
+ [ compile ratio_comparison/ratio_equal_pass.cpp ]
+ [ compile ratio_comparison/ratio_not_equal_pass.cpp ]
+ [ compile ratio_comparison/ratio_less_pass.cpp ]
+ [ compile ratio_comparison/ratio_less_equal_pass.cpp ]
+ [ compile ratio_comparison/ratio_greater_pass.cpp ]
+ [ compile ratio_comparison/ratio_greater_equal_pass.cpp ]
         ;
 
     test-suite "examples"

Added: sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_add_2_fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_add_2_fail.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/ratio.hpp>
+
+template <typename R>
+struct numerator;
+
+template <boost::intmax_t N, boost::intmax_t D>
+struct numerator<boost::ratio<N,D> > {
+ static const boost::intmax_t value = N;
+};
+
+
+BOOST_RATIO_STATIC_ASSERT(
+ numerator<boost::ratio_add<ratio<1,2>,ratio<1,3> >::value == 1
+ , NOTHING, ());

Added: sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_add_3_fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_add_3_fail.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+//#define BOOST_RATIO_EXTENSIONS
+
+#include <boost/ratio.hpp>
+
+template <typename T, typename R>
+struct S {
+ T val;
+};
+
+boost::intmax_t func(S<int, boost::ratio<5,6> > const& s) {
+ return s.val*3;
+}
+
+
+boost::intmax_t test() {
+ return func(
+ S<int, boost::ratio_add<
+ boost::ratio<1,2>,
+ boost::ratio<1,3>
+ >
+// ::type
+ >()
+ );
+}
+

Added: sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_add_fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_add_fail.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/ratio.hpp>
+
+typedef boost::ratio<BOOST_INTMAX_C(0x7FFFFFFFFFFFFFFF), 1> R1;
+typedef boost::ratio<1, 1> R2;
+typedef boost::ratio_add<R1, R2>::type RT;

Added: sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_add_pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_add_pass.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// test ratio_add
+
+#include <boost/ratio.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+void test()
+{
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::ratio<1, 1> R2;
+ typedef boost::ratio_add<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 2 && R::den == 1, NOTHING, ());
+ typedef boost::ratio_add<R, R2> RR;
+ BOOST_RATIO_STATIC_ASSERT(RR::num == 3 && RR::den == 1, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 2> R1;
+ typedef boost::ratio<1, 1> R2;
+ typedef boost::ratio_add<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 3 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-1, 2> R1;
+ typedef boost::ratio<1, 1> R2;
+ typedef boost::ratio_add<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, -2> R1;
+ typedef boost::ratio<1, 1> R2;
+ typedef boost::ratio_add<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 2> R1;
+ typedef boost::ratio<-1, 1> R2;
+ typedef boost::ratio_add<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 2> R1;
+ typedef boost::ratio<1, -1> R2;
+ typedef boost::ratio_add<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<56987354, 467584654> R1;
+ typedef boost::ratio<544668, 22145> R2;
+ typedef boost::ratio_add<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 127970191639601LL && R::den == 5177331081415LL, NOTHING, ());
+ }
+}
+
+boost::intmax_t func(boost::ratio<5,6> s) {
+ return s.num;
+}
+
+
+boost::intmax_t test_conversion() {
+ return func(
+ boost::ratio_add<
+ boost::ratio<1,2>,
+ boost::ratio<1,3>
+ >
+ ()
+ );
+}
+

Added: sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_divide_fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_divide_fail.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// test ratio_divide
+
+#include <boost/ratio.hpp>
+
+typedef boost::ratio<BOOST_INTMAX_C(0x7FFFFFFFFFFFFFFF), 1> R1;
+typedef boost::ratio<1,2> R2;
+typedef boost::ratio_divide<R1, R2>::type RT;

Added: sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_divide_pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_divide_pass.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// test ratio_divide
+
+#include <boost/ratio.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+void test()
+{
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::ratio<1, 1> R2;
+ typedef boost::ratio_divide<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 1, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 2> R1;
+ typedef boost::ratio<1, 1> R2;
+ typedef boost::ratio_divide<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-1, 2> R1;
+ typedef boost::ratio<1, 1> R2;
+ typedef boost::ratio_divide<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, -2> R1;
+ typedef boost::ratio<1, 1> R2;
+ typedef boost::ratio_divide<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 2> R1;
+ typedef boost::ratio<-1, 1> R2;
+ typedef boost::ratio_divide<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 2> R1;
+ typedef boost::ratio<1, -1> R2;
+ typedef boost::ratio_divide<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<56987354, 467584654> R1;
+ typedef boost::ratio<544668, 22145> R2;
+ typedef boost::ratio_divide<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 630992477165LL && R::den == 127339199162436LL, NOTHING, ());
+ }
+}

Added: sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_multiply_fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_multiply_fail.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// test ratio_multiply
+
+#include <boost/ratio.hpp>
+
+typedef boost::ratio<BOOST_INTMAX_C(0x7FFFFFFFFFFFFFFF), 1> R1;
+typedef boost::ratio<2,1> R2;
+typedef boost::ratio_multiply<R1, R2>::type RT;

Added: sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_multiply_pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_multiply_pass.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// test ratio_multiply
+
+#include <boost/ratio.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+void test()
+{
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::ratio<1, 1> R2;
+ typedef boost::ratio_multiply<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 1, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 2> R1;
+ typedef boost::ratio<1, 1> R2;
+ typedef boost::ratio_multiply<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-1, 2> R1;
+ typedef boost::ratio<1, 1> R2;
+ typedef boost::ratio_multiply<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, -2> R1;
+ typedef boost::ratio<1, 1> R2;
+ typedef boost::ratio_multiply<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 2> R1;
+ typedef boost::ratio<-1, 1> R2;
+ typedef boost::ratio_multiply<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 2> R1;
+ typedef boost::ratio<1, -1> R2;
+ typedef boost::ratio_multiply<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<56987354, 467584654> R1;
+ typedef boost::ratio<544668, 22145> R2;
+ typedef boost::ratio_multiply<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 15519594064236LL && R::den == 5177331081415LL, NOTHING, ());
+ }
+}

Added: sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_subtract_fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_subtract_fail.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// test ratio_subtract
+
+#include <boost/ratio.hpp>
+
+typedef boost::ratio<BOOST_INTMAX_C(-0x7FFFFFFFFFFFFFFF), 1> R1;
+typedef boost::ratio<1,1> R2;
+typedef boost::ratio_subtract<R1, R2>::type RT;

Added: sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_subtract_pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_arithmetic/ratio_subtract_pass.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// test ratio_subtract
+
+#include <boost/ratio.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+void test()
+{
+
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::ratio<1, 1> R2;
+ typedef boost::ratio_subtract<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 0 && R::den == 1, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 2> R1;
+ typedef boost::ratio<1, 1> R2;
+ typedef boost::ratio_subtract<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-1, 2> R1;
+ typedef boost::ratio<1, 1> R2;
+ typedef boost::ratio_subtract<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == -3 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, -2> R1;
+ typedef boost::ratio<1, 1> R2;
+ typedef boost::ratio_subtract<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == -3 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 2> R1;
+ typedef boost::ratio<-1, 1> R2;
+ typedef boost::ratio_subtract<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 3 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 2> R1;
+ typedef boost::ratio<1, -1> R2;
+ typedef boost::ratio_subtract<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 3 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<56987354, 467584654> R1;
+ typedef boost::ratio<544668, 22145> R2;
+ typedef boost::ratio_subtract<R1, R2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == -126708206685271LL && R::den == 5177331081415LL, NOTHING, ());
+ }
+}

Added: sandbox/chrono/libs/ratio/test/ratio_comparison/ratio_equal_pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_comparison/ratio_equal_pass.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// test ratio_equal
+
+#include <boost/ratio.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+#define BOOST_RATIO_INTMAX_T_MAX (0x7FFFFFFFFFFFFFFFLL-1)
+
+void test()
+{
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::ratio<1, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1;
+ typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::ratio<1, -1> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1;
+ typedef boost::ratio<1, -BOOST_RATIO_INTMAX_T_MAX> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_equal<R1, R2>::value), NOTHING, ());
+ }
+}

Added: sandbox/chrono/libs/ratio/test/ratio_comparison/ratio_greater_equal_pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_comparison/ratio_greater_equal_pass.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/ratio.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+#define BOOST_RATIO_INTMAX_T_MAX (0x7FFFFFFFFFFFFFFFLL-1)
+
+void test()
+{
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::ratio<1, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_greater_equal<R1, R2>::value), NOTHING, ());
+ }
+// {
+// typedef std::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+// typedef std::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+// BOOST_RATIO_STATIC_ASSERT((std::ratio_greater_equal<R1, R2>::value), NOTHING, ());
+// }
+// {
+// typedef std::ratio<1,BOOST_RATIO_INTMAX_T_MAX> R1;
+// typedef std::ratio<1,BOOST_RATIO_INTMAX_T_MAX> R2;
+// BOOST_RATIO_STATIC_ASSERT((std::ratio_greater_equal<R1, R2>::value), NOTHING, ());
+// }
+ {
+ typedef boost::mpl::integral_c<long long int, 0xffffffffffffffffLL> LL;
+ typedef boost::mpl::integral_c<boost::intmax_t, LLONG_MAX> LL2;
+ typedef boost::mpl::integral_c<boost::intmax_t, -LLONG_MAX> LL3;
+ boost::intmax_t i = boost::integer::static_signed_sign<BOOST_RATIO_INTMAX_T_MAX>::value;
+ boost::intmax_t j = boost::integer::static_signed_abs<BOOST_RATIO_INTMAX_T_MAX-1>::value;
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+// BOOST_RATIO_STATIC_ASSERT((boost::ratio_greater_equal<R1, R2>::value), NOTHING, ());
+ }
+#if 0
+ {
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_greater_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1;
+ typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_greater_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::ratio<1, -1> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_greater_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_greater_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_greater_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1;
+ typedef boost::ratio<1, -BOOST_RATIO_INTMAX_T_MAX> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_greater_equal<R1, R2>::value), NOTHING, ());
+ }
+#endif
+}

Added: sandbox/chrono/libs/ratio/test/ratio_comparison/ratio_greater_pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_comparison/ratio_greater_pass.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/ratio.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+#define BOOST_RATIO_INTMAX_T_MAX (0x7FFFFFFFFFFFFFFFLL-1)
+
+void test()
+{
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::ratio<1, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_greater<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_greater<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_greater<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1;
+ typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_greater<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::ratio<1, -1> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_greater<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_greater<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_greater<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1;
+ typedef boost::ratio<1, -BOOST_RATIO_INTMAX_T_MAX> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_greater<R1, R2>::value), NOTHING, ());
+ }
+}

Added: sandbox/chrono/libs/ratio/test/ratio_comparison/ratio_less_equal_pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_comparison/ratio_less_equal_pass.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/ratio.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+#define BOOST_RATIO_INTMAX_T_MAX (0x7FFFFFFFFFFFFFFFLL-1)
+
+void test()
+{
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::ratio<1, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_less_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_less_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_less_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1;
+ typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_less_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::ratio<1, -1> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_less_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_less_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_less_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1;
+ typedef boost::ratio<1, -BOOST_RATIO_INTMAX_T_MAX> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_less_equal<R1, R2>::value), NOTHING, ());
+ }
+}

Added: sandbox/chrono/libs/ratio/test/ratio_comparison/ratio_less_pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_comparison/ratio_less_pass.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,92 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/ratio.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+#define BOOST_RATIO_INTMAX_T_MAX (0x7FFFFFFFFFFFFFFFLL-1)
+void test()
+{
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::ratio<1, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_less<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_less<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_less<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1;
+ typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_less<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::ratio<1, -1> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_less<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_less<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_less<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1;
+ typedef boost::ratio<1, -BOOST_RATIO_INTMAX_T_MAX> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_less<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 0x7FFFFFFFFFFFFFFELL> R1;
+ typedef boost::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_less<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1;
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 0x7FFFFFFFFFFFFFFELL> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_less<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1;
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 0x7FFFFFFFFFFFFFFELL> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_less<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 0x7FFFFFFFFFFFFFFELL> R1;
+ typedef boost::ratio<0x7FFFFFFFFFFFFFFELL, 0x7FFFFFFFFFFFFFFDLL> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_less<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<641981, 1339063> R1;
+ typedef boost::ratio<1291640, 2694141LL> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_less<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1291640, 2694141LL> R1;
+ typedef boost::ratio<641981, 1339063> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_less<R1, R2>::value), NOTHING, ());
+ }
+}

Added: sandbox/chrono/libs/ratio/test/ratio_comparison/ratio_not_equal_pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_comparison/ratio_not_equal_pass.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/ratio.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+#define BOOST_RATIO_INTMAX_T_MAX (0x7FFFFFFFFFFFFFFFLL-1)
+
+void test()
+{
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::ratio<1, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_not_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_not_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_not_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1;
+ typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R2;
+ BOOST_RATIO_STATIC_ASSERT((!boost::ratio_not_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::ratio<1, -1> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_not_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_not_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1;
+ typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_not_equal<R1, R2>::value), NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1;
+ typedef boost::ratio<1, -BOOST_RATIO_INTMAX_T_MAX> R2;
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio_not_equal<R1, R2>::value), NOTHING, ());
+ }
+}

Added: sandbox/chrono/libs/ratio/test/ratio_io/ratio_io_fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_io/ratio_io_fail.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/ratio/ratio_io.hpp>
+
+//typedef boost::ratio_string<boost::ratio_add<boost::ratio<1,2>, boost::ratio<1,3> >, char> R1;
+typedef boost::ratio_string<int, char> R1;
+
+void test() {
+
+ std::string str = R1::short_name();
+}

Added: sandbox/chrono/libs/ratio/test/ratio_io/ratio_io_pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_io/ratio_io_pass.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,178 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// test ratio_add
+
+#include <boost/ratio/ratio_io.hpp>
+#include <boost/detail/lightweight_test.hpp>
+//~ #include <iostream>
+#include <climits>
+
+int main()
+{
+ //~ std::cout << std::hex<< boost::integer_traits<boost::intmax_t>::const_min << std::dec << std::endl;
+ typedef boost::mpl::integral_c<boost::intmax_t, boost::integer_traits<boost::intmax_t>::const_min> tmin;
+ typedef boost::mpl::integral_c<boost::intmax_t, boost::integer_traits<boost::intmax_t>::const_max> tmax;
+ //~ std::cout << std::hex<< boost::integer_traits<boost::intmax_t>::const_max << std::dec << std::endl;
+ typedef boost::mpl::integral_c<boost::intmax_t,
+ (boost::integer_traits<boost::intmax_t>::const_max <0)? -boost::integer_traits<boost::intmax_t>::const_max:boost::integer_traits<boost::intmax_t>::const_max
+ > tmmax;
+ //~ std::cout << std::hex<< boost::mpl::integral_c<boost::intmax_t,
+ //~ boost::integer_traits<boost::intmax_t>::const_max
+ //~ >::value << std::dec << std::endl;
+
+// typedef boost::mpl::integral_c<boost::intmax_t,
+// (boost::integer_traits<boost::intmax_t>::const_max <0)? -boost::integer_traits<boost::intmax_t>::const_max:boost::integer_traits<boost::intmax_t>::const_max
+// >::next tmmaxn;
+// typedef boost::mpl::integral_c<boost::intmax_t,
+// (boost::integer_traits<boost::intmax_t>::const_max <0)? -boost::integer_traits<boost::intmax_t>::const_max:boost::integer_traits<boost::intmax_t>::const_max
+// >::prior tmmaxp;
+
+
+ //~ std::cout << std::hex<< -0x7FFFFFFFFFFFFFFFLL+1 << std::dec << std::endl;
+ //~ std::cout << std::hex<< -0x7FFFFFFFFFFFFFFFLL-1 << std::dec << std::endl;
+ //~ std::cout << std::hex<< -0x7FFFFFFFFFFFFFFFLL << std::dec << std::endl;
+ //~ std::cout << std::hex<< 0x7FFFFFFFFFFFFFFFLL-1 << std::dec << std::endl;
+ {
+ BOOST_TEST((
+ boost::ratio_string<boost::atto, char>::long_name() == "atto"
+ ));
+ BOOST_TEST((
+ boost::ratio_string<boost::atto, char>::short_name() == "a"
+ ));
+ }
+ {
+ BOOST_TEST((
+ boost::ratio_string<boost::femto, char>::long_name() == "femto"
+ ));
+ BOOST_TEST((
+ boost::ratio_string<boost::femto, char>::short_name() == "f"
+ ));
+ }
+ {
+ BOOST_TEST((
+ boost::ratio_string<boost::pico, char>::long_name() == "pico"
+ ));
+ BOOST_TEST((
+ boost::ratio_string<boost::pico, char>::short_name() == "p"
+ ));
+ }
+ {
+ BOOST_TEST((
+ boost::ratio_string<boost::nano, char>::long_name() == "nano"
+ ));
+ BOOST_TEST((
+ boost::ratio_string<boost::nano, char>::short_name() == "n"
+ ));
+ }
+ {
+ BOOST_TEST((
+ boost::ratio_string<boost::micro, char>::long_name() == "micro"
+ ));
+ BOOST_TEST((
+ boost::ratio_string<boost::micro, char>::short_name() == "\xC2\xB5"
+ ));
+ }
+ {
+ BOOST_TEST((
+ boost::ratio_string<boost::milli, char>::long_name() == "milli"
+ ));
+ BOOST_TEST((
+ boost::ratio_string<boost::milli, char>::short_name() == "m"
+ ));
+ }
+ {
+ BOOST_TEST((
+ boost::ratio_string<boost::centi, char>::long_name() == "centi"
+ ));
+ BOOST_TEST((
+ boost::ratio_string<boost::centi, char>::short_name() == "c"
+ ));
+ }
+ {
+ BOOST_TEST((
+ boost::ratio_string<boost::deci, char>::long_name() == "deci"
+ ));
+ BOOST_TEST((
+ boost::ratio_string<boost::deci, char>::short_name() == "d"
+ ));
+ }
+ {
+ BOOST_TEST((
+ boost::ratio_string<boost::deca, char>::long_name() == "deca"
+ ));
+ BOOST_TEST((
+ boost::ratio_string<boost::deca, char>::short_name() == "da"
+ ));
+ }
+ {
+ BOOST_TEST((
+ boost::ratio_string<boost::hecto, char>::long_name() == "hecto"
+ ));
+ BOOST_TEST((
+ boost::ratio_string<boost::hecto, char>::short_name() == "h"
+ ));
+ }
+ {
+ BOOST_TEST((
+ boost::ratio_string<boost::kilo, char>::long_name() == "kilo"
+ ));
+ BOOST_TEST((
+ boost::ratio_string<boost::kilo, char>::short_name() == "k"
+ ));
+ }
+ {
+ BOOST_TEST((
+ boost::ratio_string<boost::mega, char>::long_name() == "mega"
+ ));
+ BOOST_TEST((
+ boost::ratio_string<boost::mega, char>::short_name() == "M"
+ ));
+ }
+ {
+ BOOST_TEST((
+ boost::ratio_string<boost::giga, char>::long_name() == "giga"
+ ));
+ BOOST_TEST((
+ boost::ratio_string<boost::giga, char>::short_name() == "G"
+ ));
+ }
+ {
+ BOOST_TEST((
+ boost::ratio_string<boost::tera, char>::long_name() == "tera"
+ ));
+ BOOST_TEST((
+ boost::ratio_string<boost::tera, char>::short_name() == "T"
+ ));
+ }
+ {
+ BOOST_TEST((
+ boost::ratio_string<boost::peta, char>::long_name() == "peta"
+ ));
+ BOOST_TEST((
+ boost::ratio_string<boost::peta, char>::short_name() == "P"
+ ));
+ }
+ {
+ BOOST_TEST((
+ boost::ratio_string<boost::exa, char>::long_name() == "exa"
+ ));
+ BOOST_TEST((
+ boost::ratio_string<boost::exa, char>::short_name() == "E"
+ ));
+ }
+// return 1;
+ return boost::report_errors();
+}
+
+

Added: sandbox/chrono/libs/ratio/test/ratio_ratio/ratio1_fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_ratio/ratio1_fail.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// test ratio: The template argument D mus not be zero
+
+#include <boost/ratio.hpp>
+#include <boost/cstdint.hpp>
+
+void test()
+{
+ const boost::intmax_t t1 = boost::ratio<1, 0>::num;
+ (void)t1;
+}

Added: sandbox/chrono/libs/ratio/test/ratio_ratio/ratio2_fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_ratio/ratio2_fail.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// test ratio: the absolute values of the template arguments N and D
+// must be representable by type intmax_t.
+
+#include <boost/ratio.hpp>
+#include <cstdint>
+
+void test()
+{
+ const boost::intmax_t t1 = boost::ratio<0x8000000000000000ULL, 1>::num;
+ (void)t1;
+}

Added: sandbox/chrono/libs/ratio/test/ratio_ratio/ratio3_fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_ratio/ratio3_fail.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// test ratio: the absolute values of the template arguments N and D
+// must be representable by type intmax_t.
+
+#include <boost/ratio.hpp>
+#include <boost/cstdint.hpp>
+
+void test()
+{
+ const boost::intmax_t t1 = boost::ratio<1, 0x8000000000000000ULL>::num;
+ (void)t1;
+}

Added: sandbox/chrono/libs/ratio/test/ratio_ratio/ratio4_fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_ratio/ratio4_fail.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+//#define BOOST_RATIO_EXTENSIONS
+
+#include <boost/ratio.hpp>
+
+boost::intmax_t func(boost::ratio<5,6> const& s) {
+ return s.num;
+}
+
+boost::intmax_t test() {
+ return func(boost::ratio<10,12>());
+}
+

Added: sandbox/chrono/libs/ratio/test/ratio_ratio/ratio_pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/ratio_ratio/ratio_pass.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 2010)
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// test ratio: The static data members num and den shall have thcommon
+// divisor of the absolute values of N and D:
+
+#include <boost/ratio.hpp>
+
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+#define BOOST_RATIO_INTMAX_T_MAX (0x7FFFFFFFFFFFFFFFLL-1)
+
+template <long long N, long long D, long long eN, long long eD>
+void test()
+{
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio<N, D>::num == eN), NOTHING, (boost::mpl::integral_c<boost::intmax_t,boost::ratio<N, D>::num>));
+ BOOST_RATIO_STATIC_ASSERT((boost::ratio<N, D>::den == eD), NOTHING, (boost::mpl::integral_c<boost::intmax_t,boost::ratio<N, D>::den>));
+}
+
+int main()
+{
+ test<1, 1, 1, 1>();
+ test<1, 10, 1, 10>();
+ test<10, 10, 1, 1>();
+ test<10, 1, 10, 1>();
+ test<12, 4, 3, 1>();
+ test<12, -4, -3, 1>();
+ test<-12, 4, -3, 1>();
+ test<-12, -4, 3, 1>();
+ test<4, 12, 1, 3>();
+ test<4, -12, -1, 3>();
+ test<-4, 12, -1, 3>();
+ test<-4, -12, 1, 3>();
+ test<222, 333, 2, 3>();
+ test<222, -333, -2, 3>();
+ test<-222, 333, -2, 3>();
+ test<-222, -333, 2, 3>();
+ //~ test<BOOST_RATIO_INTMAX_T_MAX, 127, 72624976668147841LL, 1>();
+ //~ test<-BOOST_RATIO_INTMAX_T_MAX, 127, -72624976668147841LL, 1>();
+ //~ test<BOOST_RATIO_INTMAX_T_MAX, -127, -72624976668147841LL, 1>();
+ //~ test<-BOOST_RATIO_INTMAX_T_MAX, -127, 72624976668147841LL, 1>();
+ test<BOOST_RATIO_INTMAX_T_MAX, 127, BOOST_RATIO_INTMAX_T_MAX, 127>();
+ test<-BOOST_RATIO_INTMAX_T_MAX, 127, -BOOST_RATIO_INTMAX_T_MAX, 127>();
+ test<BOOST_RATIO_INTMAX_T_MAX, -127, -BOOST_RATIO_INTMAX_T_MAX, 127>();
+ test<-BOOST_RATIO_INTMAX_T_MAX, -127, BOOST_RATIO_INTMAX_T_MAX, 127>();
+}

Added: sandbox/chrono/libs/ratio/test/typedefs_pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/ratio/test/typedefs_pass.cpp 2010-12-19 05:42:59 EST (Sun, 19 Dec 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
+
+// test ratio typedef's
+
+#include <boost/ratio.hpp>
+
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+BOOST_RATIO_STATIC_ASSERT(boost::atto::num == 1 && boost::atto::den == 1000000000000000000ULL, NOTHING, ());
+BOOST_RATIO_STATIC_ASSERT(boost::femto::num == 1 && boost::femto::den == 1000000000000000ULL, NOTHING, ());
+BOOST_RATIO_STATIC_ASSERT(boost::pico::num == 1 && boost::pico::den == 1000000000000ULL, NOTHING, ());
+BOOST_RATIO_STATIC_ASSERT(boost::nano::num == 1 && boost::nano::den == 1000000000ULL, NOTHING, ());
+BOOST_RATIO_STATIC_ASSERT(boost::micro::num == 1 && boost::micro::den == 1000000ULL, NOTHING, ());
+BOOST_RATIO_STATIC_ASSERT(boost::milli::num == 1 && boost::milli::den == 1000ULL, NOTHING, ());
+BOOST_RATIO_STATIC_ASSERT(boost::centi::num == 1 && boost::centi::den == 100ULL, NOTHING, ());
+BOOST_RATIO_STATIC_ASSERT(boost::deci::num == 1 && boost::deci::den == 10ULL, NOTHING, ());
+BOOST_RATIO_STATIC_ASSERT(boost::deca::num == 10ULL && boost::deca::den == 1, NOTHING, ());
+BOOST_RATIO_STATIC_ASSERT(boost::hecto::num == 100ULL && boost::hecto::den == 1, NOTHING, ());
+BOOST_RATIO_STATIC_ASSERT(boost::kilo::num == 1000ULL && boost::kilo::den == 1, NOTHING, ());
+BOOST_RATIO_STATIC_ASSERT(boost::mega::num == 1000000ULL && boost::mega::den == 1, NOTHING, ());
+BOOST_RATIO_STATIC_ASSERT(boost::giga::num == 1000000000ULL && boost::giga::den == 1, NOTHING, ());
+BOOST_RATIO_STATIC_ASSERT(boost::tera::num == 1000000000000ULL && boost::tera::den == 1, NOTHING, ());
+BOOST_RATIO_STATIC_ASSERT(boost::peta::num == 1000000000000000ULL && boost::peta::den == 1, NOTHING, ());
+BOOST_RATIO_STATIC_ASSERT(boost::exa::num == 1000000000000000000ULL && boost::exa::den == 1, 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