Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68030 - in trunk/libs/ratio/test: . ratio_extensions
From: vicente.botet_at_[hidden]
Date: 2011-01-12 00:07:04


Author: viboes
Date: 2011-01-12 00:07:02 EST (Wed, 12 Jan 2011)
New Revision: 68030
URL: http://svn.boost.org/trac/boost/changeset/68030

Log:
Boost.Ratio: Added more mpl arithmetic operations

Added:
   trunk/libs/ratio/test/ratio_extensions/mpl_abs_pass.cpp (contents, props changed)
   trunk/libs/ratio/test/ratio_extensions/mpl_negate_pass.cpp (contents, props changed)
   trunk/libs/ratio/test/ratio_extensions/mpl_sign_pass.cpp (contents, props changed)
Text files modified:
   trunk/libs/ratio/test/Jamfile.v2 | 3 +++
   1 files changed, 3 insertions(+), 0 deletions(-)

Modified: trunk/libs/ratio/test/Jamfile.v2
==============================================================================
--- trunk/libs/ratio/test/Jamfile.v2 (original)
+++ trunk/libs/ratio/test/Jamfile.v2 2011-01-12 00:07:02 EST (Wed, 12 Jan 2011)
@@ -97,6 +97,9 @@
         [ compile ratio_extensions/mpl_minus_pass.cpp ]
         [ compile ratio_extensions/mpl_times_pass.cpp ]
         [ compile ratio_extensions/mpl_divides_pass.cpp ]
+ [ compile ratio_extensions/mpl_negate_pass.cpp ]
+ [ compile ratio_extensions/mpl_sign_pass.cpp ]
+ [ compile ratio_extensions/mpl_abs_pass.cpp ]
         [ compile ratio_extensions/mpl_equal_to_pass.cpp ]
         [ compile ratio_extensions/mpl_not_equal_to_pass.cpp ]
         [ compile ratio_extensions/mpl_less_pass.cpp ]

Added: trunk/libs/ratio/test/ratio_extensions/mpl_abs_pass.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/ratio/test/ratio_extensions/mpl_abs_pass.cpp 2011-01-12 00:07:02 EST (Wed, 12 Jan 2011)
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 mpl::abs
+
+#define BOOST_RATIO_EXTENSIONS
+
+#include <boost/ratio/mpl/abs.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+void test()
+{
+
+ {
+ typedef boost::ratio<0> R1;
+ typedef boost::mpl::abs<R1> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 0 && R::den == 1, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::mpl::abs<R1> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 1, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 2> R1;
+ typedef boost::mpl::abs<R1> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-1, 2> R1;
+ typedef boost::mpl::abs<R1> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, -2> R1;
+ typedef boost::mpl::abs<R1> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ());
+ }
+}

Added: trunk/libs/ratio/test/ratio_extensions/mpl_negate_pass.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/ratio/test/ratio_extensions/mpl_negate_pass.cpp 2011-01-12 00:07:02 EST (Wed, 12 Jan 2011)
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 mpl::negate
+
+#define BOOST_RATIO_EXTENSIONS
+
+#include <boost/ratio/mpl/negate.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+void test()
+{
+
+ {
+ typedef boost::ratio<0> R1;
+ typedef boost::mpl::negate<R1> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 0 && R::den == 1, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::mpl::negate<R1> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 1, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 2> R1;
+ typedef boost::mpl::negate<R1> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-1, 2> R1;
+ typedef boost::mpl::negate<R1> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, -2> R1;
+ typedef boost::mpl::negate<R1> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ());
+ }
+}

Added: trunk/libs/ratio/test/ratio_extensions/mpl_sign_pass.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/ratio/test/ratio_extensions/mpl_sign_pass.cpp 2011-01-12 00:07:02 EST (Wed, 12 Jan 2011)
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 mpl::sign
+
+#define BOOST_RATIO_EXTENSIONS
+
+#include <boost/ratio/mpl/sign.hpp>
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+void test()
+{
+
+ {
+ typedef boost::ratio<0> R1;
+ typedef boost::mpl::sign<R1> R;
+ BOOST_RATIO_STATIC_ASSERT(R::value == 0, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 1> R1;
+ typedef boost::mpl::sign<R1> R;
+ BOOST_RATIO_STATIC_ASSERT(R::value == 1, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 2> R1;
+ typedef boost::mpl::sign<R1> R;
+ BOOST_RATIO_STATIC_ASSERT(R::value == 1, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-1, 2> R1;
+ typedef boost::mpl::sign<R1> R;
+ BOOST_RATIO_STATIC_ASSERT(R::value == -1, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, -2> R1;
+ typedef boost::mpl::sign<R1> R;
+ BOOST_RATIO_STATIC_ASSERT(R::value == -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