$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r65480 - sandbox/chrono/libs/ratio/test/ratio_arithmetic
From: vicente.botet_at_[hidden]
Date: 2010-09-20 07:54:40
Author: viboes
Date: 2010-09-20 07:54:39 EDT (Mon, 20 Sep 2010)
New Revision: 65480
URL: http://svn.boost.org/trac/boost/changeset/65480
Log:
Adapt tests coming from llvm/libc++/test/ratio
Added:
   sandbox/chrono/libs/ratio/test/ratio_arithmetic/
   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)
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-09-20 07:54:39 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,21 @@
+//  Copyright 2010 Vicente J. Botet Escriba
+//  Distributed under the Boost Software License, Version 1.0.
+//  See http://www.boost.org/LICENSE_1_0.txt
+
+// Taken from llvm/libcxx/test/utilities/ratio
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_add
+
+#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-09-20 07:54:39 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,66 @@
+//  Copyright 2010 Vicente J. Botet Escriba
+//  Distributed under the Boost Software License, Version 1.0.
+//  See http://www.boost.org/LICENSE_1_0.txt
+
+// Taken from llvm/libcxx/test/utilities/ratio
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_add
+
+#include <boost/ratio.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+int main()
+{
+    {
+    typedef boost::ratio<1, 1> R1;
+    typedef boost::ratio<1, 1> R2;
+    typedef boost::ratio_add<R1, R2>::type R;
+    BOOST_RATIO_STATIC_ASSERT(R::num == 2 && R::den == 1, NOTHING, ());
+    }
+    {
+    typedef boost::ratio<1, 2> R1;
+    typedef boost::ratio<1, 1> R2;
+    typedef boost::ratio_add<R1, R2>::type 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>::type 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>::type 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>::type 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>::type 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>::type R;
+    BOOST_RATIO_STATIC_ASSERT(R::num == 127970191639601LL && R::den == 5177331081415LL, NOTHING, ());
+    }
+}
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-09-20 07:54:39 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,21 @@
+//  Copyright 2010 Vicente J. Botet Escriba
+//  Distributed under the Boost Software License, Version 1.0.
+//  See http://www.boost.org/LICENSE_1_0.txt
+
+// Taken from llvm/libcxx/test/utilities/ratio
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// 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-09-20 07:54:39 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,66 @@
+//  Copyright 2010 Vicente J. Botet Escriba
+//  Distributed under the Boost Software License, Version 1.0.
+//  See http://www.boost.org/LICENSE_1_0.txt
+
+// Taken from llvm/libcxx/test/utilities/ratio
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_divide
+
+#include <boost/ratio.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+int main()
+{
+    {
+    typedef boost::ratio<1, 1> R1;
+    typedef boost::ratio<1, 1> R2;
+    typedef boost::ratio_divide<R1, R2>::type 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>::type 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>::type 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>::type 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>::type 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>::type 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>::type 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-09-20 07:54:39 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,21 @@
+//  Copyright 2010 Vicente J. Botet Escriba
+//  Distributed under the Boost Software License, Version 1.0.
+//  See http://www.boost.org/LICENSE_1_0.txt
+
+// Taken from llvm/libcxx/test/utilities/ratio
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// 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-09-20 07:54:39 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,66 @@
+//  Copyright 2010 Vicente J. Botet Escriba
+//  Distributed under the Boost Software License, Version 1.0.
+//  See http://www.boost.org/LICENSE_1_0.txt
+
+// Taken from llvm/libcxx/test/utilities/ratio
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_multiply
+
+#include <boost/ratio.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+int main()
+{
+    {
+    typedef boost::ratio<1, 1> R1;
+    typedef boost::ratio<1, 1> R2;
+    typedef boost::ratio_multiply<R1, R2>::type 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>::type 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>::type 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>::type 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>::type 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>::type 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>::type 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-09-20 07:54:39 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,21 @@
+//  Copyright 2010 Vicente J. Botet Escriba
+//  Distributed under the Boost Software License, Version 1.0.
+//  See http://www.boost.org/LICENSE_1_0.txt
+
+// Taken from llvm/libcxx/test/utilities/ratio
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// 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-09-20 07:54:39 EDT (Mon, 20 Sep 2010)
@@ -0,0 +1,67 @@
+//  Copyright 2010 Vicente J. Botet Escriba
+//  Distributed under the Boost Software License, Version 1.0.
+//  See http://www.boost.org/LICENSE_1_0.txt
+
+// Taken from llvm/libcxx/test/utilities/ratio
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// test ratio_subtract
+
+#include <boost/ratio.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+int main()
+{
+
+    {
+    typedef boost::ratio<1, 1> R1;
+    typedef boost::ratio<1, 1> R2;
+    typedef boost::ratio_subtract<R1, R2>::type 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>::type 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>::type 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>::type 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>::type 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>::type 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>::type R;
+    BOOST_RATIO_STATIC_ASSERT(R::num == -126708206685271LL && R::den == 5177331081415LL, NOTHING, ());
+    }
+}