|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r86594 - in trunk: boost/ratio boost/ratio/detail libs/ratio libs/ratio/test libs/ratio/test/ratio_arithmetic libs/ratio/test/ratio_io
From: vicente.botet_at_[hidden]
Date: 2013-11-09 06:47:43
Author: viboes
Date: 2013-11-09 06:47:43 EST (Sat, 09 Nov 2013)
New Revision: 86594
URL: http://svn.boost.org/trac/boost/changeset/86594
Log:
Ratio: Added ratio binary prefixes and ratio_power.
Added:
trunk/libs/ratio/test/ratio_arithmetic/ratio_power_pass.cpp (contents, props changed)
Properties modified:
trunk/libs/ratio/ (props changed)
Text files modified:
trunk/boost/ratio/detail/ratio_io.hpp | 302 ++++++++++++++++++++++++++++++++++++++++
trunk/boost/ratio/ratio.hpp | 18 ++
trunk/boost/ratio/ratio_fwd.hpp | 12 +
trunk/boost/ratio/ratio_io.hpp | 257 ++++++++++++++++++++++++++++++++++
trunk/libs/ratio/test/Jamfile.v2 | 1
trunk/libs/ratio/test/ratio_arithmetic/ratio_power_pass.cpp | 60 +++++++
trunk/libs/ratio/test/ratio_io/ratio_io_pass.cpp | 18 ++
7 files changed, 667 insertions(+), 1 deletions(-)
Modified: trunk/boost/ratio/detail/ratio_io.hpp
==============================================================================
--- trunk/boost/ratio/detail/ratio_io.hpp Sat Nov 9 06:27:55 2013 (r86593)
+++ trunk/boost/ratio/detail/ratio_io.hpp 2013-11-09 06:47:43 EST (Sat, 09 Nov 2013) (r86594)
@@ -1040,6 +1040,308 @@
#endif
#endif
+#ifdef BOOST_RATIO_EXTENSIONS
+
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
+template <typename CharT>
+struct ratio_string<kibi, CharT> :
+ ratio_detail::ratio_string_static<kibi,CharT>
+{};
+
+#else
+template <>
+struct ratio_string<kibi, char>
+{
+ static std::string short_name() {return std::string("Ki");}
+ static std::string long_name() {return std::string("kibi");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
+};
+
+#if BOOST_RATIO_HAS_UNICODE_SUPPORT
+
+template <>
+struct ratio_string<kibi, char16_t>
+{
+ static std::u16string short_name() {return std::u16string(u"Ki");}
+ static std::u16string long_name() {return std::u16string(u"kibi");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
+};
+
+template <>
+struct ratio_string<kibi, char32_t>
+{
+ static std::u32string short_name() {return std::u32string(U"Ki");}
+ static std::u32string long_name() {return std::u32string(U"kibi");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
+};
+
+#endif
+
+#ifndef BOOST_NO_STD_WSTRING
+template <>
+struct ratio_string<kibi, wchar_t>
+{
+ static std::wstring short_name() {return std::wstring(L"Ki");}
+ static std::wstring long_name() {return std::wstring(L"kibi");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
+};
+#endif
+#endif
+
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
+template <typename CharT>
+struct ratio_string<mebi, CharT> :
+ ratio_detail::ratio_string_static<mebi,CharT>
+{};
+
+#else
+template <>
+struct ratio_string<mebi, char>
+{
+ static std::string short_name() {return std::string("Mi");}
+ static std::string long_name() {return std::string("mebi");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
+};
+
+#if BOOST_RATIO_HAS_UNICODE_SUPPORT
+
+template <>
+struct ratio_string<mebi, char16_t>
+{
+ static std::u16string short_name() {return std::u16string(u"Mi");}
+ static std::u16string long_name() {return std::u16string(u"mebi");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
+};
+
+template <>
+struct ratio_string<mebi, char32_t>
+{
+ static std::u32string short_name() {return std::u32string(U"Mi");}
+ static std::u32string long_name() {return std::u32string(U"mebi");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
+};
+
+#endif
+
+#ifndef BOOST_NO_STD_WSTRING
+template <>
+struct ratio_string<mebi, wchar_t>
+{
+ static std::wstring short_name() {return std::wstring(L"Mi");}
+ static std::wstring long_name() {return std::wstring(L"mebi");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
+};
+#endif
+#endif
+
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
+template <typename CharT>
+struct ratio_string<gibi, CharT> :
+ ratio_detail::ratio_string_static<gibi,CharT>
+{};
+
+#else
+template <>
+struct ratio_string<gibi, char>
+{
+ static std::string short_name() {return std::string("Gi");}
+ static std::string long_name() {return std::string("gibi");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
+};
+
+#if BOOST_RATIO_HAS_UNICODE_SUPPORT
+
+template <>
+struct ratio_string<gibi, char16_t>
+{
+ static std::u16string short_name() {return std::u16string(u"Gi");}
+ static std::u16string long_name() {return std::u16string(u"gibi");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
+};
+
+template <>
+struct ratio_string<gibi, char32_t>
+{
+ static std::u32string short_name() {return std::u32string(U"Gi");}
+ static std::u32string long_name() {return std::u32string(U"gibi");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
+};
+
+#endif
+
+#ifndef BOOST_NO_STD_WSTRING
+template <>
+struct ratio_string<gibi, wchar_t>
+{
+ static std::wstring short_name() {return std::wstring(L"Gi");}
+ static std::wstring long_name() {return std::wstring(L"gibi");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
+};
+#endif
+#endif
+
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
+template <typename CharT>
+struct ratio_string<tebi, CharT> :
+ ratio_detail::ratio_string_static<tebi,CharT>
+{};
+
+#else
+template <>
+struct ratio_string<tebi, char>
+{
+ static std::string short_name() {return std::string("Ti");}
+ static std::string long_name() {return std::string("tebi");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
+};
+
+#if BOOST_RATIO_HAS_UNICODE_SUPPORT
+
+template <>
+struct ratio_string<tebi, char16_t>
+{
+ static std::u16string short_name() {return std::u16string(u"Ti");}
+ static std::u16string long_name() {return std::u16string(u"tebi");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
+};
+
+template <>
+struct ratio_string<tebi, char32_t>
+{
+ static std::u32string short_name() {return std::u32string(U"Ti");}
+ static std::u32string long_name() {return std::u32string(U"tebi");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
+};
+
+#endif
+
+#ifndef BOOST_NO_STD_WSTRING
+template <>
+struct ratio_string<tebi, wchar_t>
+{
+ static std::wstring short_name() {return std::wstring(L"Ti");}
+ static std::wstring long_name() {return std::wstring(L"tebi");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
+};
+#endif
+#endif
+
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
+template <typename CharT>
+struct ratio_string<pebi, CharT> :
+ ratio_detail::ratio_string_static<pebi,CharT>
+{};
+
+#else
+template <>
+struct ratio_string<pebi, char>
+{
+ static std::string short_name() {return std::string("Pi");}
+ static std::string long_name() {return std::string("pebi");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
+};
+
+#if BOOST_RATIO_HAS_UNICODE_SUPPORT
+
+template <>
+struct ratio_string<pebi, char16_t>
+{
+ static std::u16string short_name() {return std::u16string(u"Pi");}
+ static std::u16string long_name() {return std::u16string(u"pebi");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
+};
+
+template <>
+struct ratio_string<pebi, char32_t>
+{
+ static std::u32string short_name() {return std::u32string(U"Pi");}
+ static std::u32string long_name() {return std::u32string(U"pebi");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
+};
+
+#endif
+
+#ifndef BOOST_NO_STD_WSTRING
+template <>
+struct ratio_string<pebi, wchar_t>
+{
+ static std::wstring short_name() {return std::wstring(L"Pi");}
+ static std::wstring long_name() {return std::wstring(L"pebi");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
+};
+#endif
+#endif
+
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
+template <typename CharT>
+struct ratio_string<exbi, CharT> :
+ ratio_detail::ratio_string_static<exbi,CharT>
+{};
+
+#else
+template <>
+struct ratio_string<exbi, char>
+{
+ static std::string short_name() {return std::string("Ei");}
+ static std::string long_name() {return std::string("exbi");}
+ static std::string symbol() {return short_name();}
+ static std::string prefix() {return long_name();}
+};
+
+#if BOOST_RATIO_HAS_UNICODE_SUPPORT
+
+template <>
+struct ratio_string<exbi, char16_t>
+{
+ static std::u16string short_name() {return std::u16string(u"Ei");}
+ static std::u16string long_name() {return std::u16string(u"exbi");}
+ static std::u16string symbol() {return short_name();}
+ static std::u16string prefix() {return long_name();}
+};
+
+template <>
+struct ratio_string<exbi, char32_t>
+{
+ static std::u32string short_name() {return std::u32string(U"Ei");}
+ static std::u32string long_name() {return std::u32string(U"exbi");}
+ static std::u32string symbol() {return short_name();}
+ static std::u32string prefix() {return long_name();}
+};
+
+#endif
+
+#ifndef BOOST_NO_STD_WSTRING
+template <>
+struct ratio_string<exbi, wchar_t>
+{
+ static std::wstring short_name() {return std::wstring(L"Ei");}
+ static std::wstring long_name() {return std::wstring(L"exbi");}
+ static std::wstring symbol() {return short_name();}
+ static std::wstring prefix() {return long_name();}
+};
+#endif
+#endif
+#endif
}
#endif // BOOST_RATIO_RATIO_IO_HPP
Modified: trunk/boost/ratio/ratio.hpp
==============================================================================
--- trunk/boost/ratio/ratio.hpp Sat Nov 9 06:27:55 2013 (r86593)
+++ trunk/boost/ratio/ratio.hpp 2013-11-09 06:47:43 EST (Sat, 09 Nov 2013) (r86594)
@@ -226,6 +226,24 @@
mpl::gcd_c<boost::intmax_t, R1::den, R2::den>::value>::type
{
};
+
+template<typename R, int p>
+struct ratio_power :
+ ratio_multiply<
+ typename ratio_power<R, p%2>::type,
+ typename ratio_power<typename ratio_multiply<R, R>::type, p/2>::type
+ >::type
+{};
+
+template<typename R>
+struct ratio_power<R, 0> : ratio<1>::type {};
+
+template<typename R>
+struct ratio_power<R, 1> : R {};
+
+template<typename R>
+struct ratio_power<R, -1> : ratio_divide<ratio<1>, R>::type {};
+
#endif
} // namespace boost
Modified: trunk/boost/ratio/ratio_fwd.hpp
==============================================================================
--- trunk/boost/ratio/ratio_fwd.hpp Sat Nov 9 06:27:55 2013 (r86593)
+++ trunk/boost/ratio/ratio_fwd.hpp 2013-11-09 06:47:43 EST (Sat, 09 Nov 2013) (r86594)
@@ -78,6 +78,18 @@
typedef ratio< BOOST_RATIO_INTMAX_C(1000000000000000), BOOST_RATIO_INTMAX_C(1)> peta;
typedef ratio<BOOST_RATIO_INTMAX_C(1000000000000000000), BOOST_RATIO_INTMAX_C(1)> exa;
+#ifdef BOOST_RATIO_EXTENSIONS
+
+#define BOOST_RATIO_1024 BOOST_RATIO_INTMAX_C(1024)
+
+typedef ratio< BOOST_RATIO_1024> kibi;
+typedef ratio< BOOST_RATIO_1024*BOOST_RATIO_1024> mebi;
+typedef ratio< BOOST_RATIO_1024*BOOST_RATIO_1024*BOOST_RATIO_1024> gibi;
+typedef ratio< BOOST_RATIO_1024*BOOST_RATIO_1024*BOOST_RATIO_1024*BOOST_RATIO_1024> tebi;
+typedef ratio< BOOST_RATIO_1024*BOOST_RATIO_1024*BOOST_RATIO_1024*BOOST_RATIO_1024*BOOST_RATIO_1024> pebi;
+typedef ratio<BOOST_RATIO_1024*BOOST_RATIO_1024*BOOST_RATIO_1024*BOOST_RATIO_1024*BOOST_RATIO_1024*BOOST_RATIO_1024> exbi;
+
+#endif
} // namespace boost
Modified: trunk/boost/ratio/ratio_io.hpp
==============================================================================
--- trunk/boost/ratio/ratio_io.hpp Sat Nov 9 06:27:55 2013 (r86593)
+++ trunk/boost/ratio/ratio_io.hpp 2013-11-09 06:47:43 EST (Sat, 09 Nov 2013) (r86594)
@@ -45,6 +45,7 @@
#include <sstream>
#ifdef BOOST_RATIO_HAS_STATIC_STRING
+#error
#include <boost/ratio/ratio_static_string.hpp>
#include <boost/static_string/static_string.hpp>
#endif
@@ -818,6 +819,262 @@
#endif
#endif
+
+#ifdef BOOST_RATIO_EXTENSIONS
+
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
+template <typename CharT>
+struct ratio_string<kibi, CharT> :
+ ratio_detail::ratio_string_static<kibi,CharT>
+{};
+
+#else
+template <>
+struct ratio_string<kibi, char>
+{
+ static std::string symbol() {return std::string("Ki");}
+ static std::string prefix() {return std::string("kibi");}
+};
+
+#if BOOST_RATIO_HAS_UNICODE_SUPPORT
+
+template <>
+struct ratio_string<kibi, char16_t>
+{
+ static std::u16string symbol() {return std::u16string(u"Ki");}
+ static std::u16string prefix() {return std::u16string(u"kibi");}
+};
+
+template <>
+struct ratio_string<kibi, char32_t>
+{
+ static std::u32string symbol() {return std::u32string(U"Ki");}
+ static std::u32string prefix() {return std::u32string(U"kibi");}
+};
+
+#endif
+
+#ifndef BOOST_NO_STD_WSTRING
+template <>
+struct ratio_string<kibi, wchar_t>
+{
+ static std::wstring symbol() {return std::wstring(L"Ki");}
+ static std::wstring prefix() {return std::wstring(L"kibi");}
+};
+#endif
+#endif
+
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
+template <typename CharT>
+struct ratio_string<mebi, CharT> :
+ ratio_detail::ratio_string_static<mebi,CharT>
+{};
+
+#else
+template <>
+struct ratio_string<mebi, char>
+{
+ static std::string symbol() {return std::string("Mi");}
+ static std::string prefix() {return std::string("mebi");}
+};
+
+#if BOOST_RATIO_HAS_UNICODE_SUPPORT
+
+template <>
+struct ratio_string<mebi, char16_t>
+{
+ static std::u16string symbol() {return std::u16string(u"Mi");}
+ static std::u16string prefix() {return std::u16string(u"mebi");}
+};
+
+template <>
+struct ratio_string<mebi, char32_t>
+{
+ static std::u32string symbol() {return std::u32string(U"Mi");}
+ static std::u32string prefix() {return std::u32string(U"mebi");}
+};
+
+#endif
+
+#ifndef BOOST_NO_STD_WSTRING
+template <>
+struct ratio_string<mebi, wchar_t>
+{
+ static std::wstring symbol() {return std::wstring(L"Mi");}
+ static std::wstring prefix() {return std::wstring(L"mebi");}
+};
+#endif
+#endif
+
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
+template <typename CharT>
+struct ratio_string<gibi, CharT> :
+ ratio_detail::ratio_string_static<gibi,CharT>
+{};
+
+#else
+template <>
+struct ratio_string<gibi, char>
+{
+ static std::string symbol() {return std::string("Gi");}
+ static std::string prefix() {return std::string("gibi");}
+};
+
+#if BOOST_RATIO_HAS_UNICODE_SUPPORT
+
+template <>
+struct ratio_string<gibi, char16_t>
+{
+ static std::u16string symbol() {return std::u16string(u"Gi");}
+ static std::u16string prefix() {return std::u16string(u"gibi");}
+};
+
+template <>
+struct ratio_string<gibi, char32_t>
+{
+ static std::u32string symbol() {return std::u32string(U"Gi");}
+ static std::u32string prefix() {return std::u32string(U"gibi");}
+};
+
+#endif
+
+#ifndef BOOST_NO_STD_WSTRING
+template <>
+struct ratio_string<gibi, wchar_t>
+{
+ static std::wstring symbol() {return std::wstring(L"Gi");}
+ static std::wstring prefix() {return std::wstring(L"gibi");}
+};
+#endif
+#endif
+
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
+template <typename CharT>
+struct ratio_string<tebi, CharT> :
+ ratio_detail::ratio_string_static<tebi,CharT>
+{};
+
+#else
+template <>
+struct ratio_string<tebi, char>
+{
+ static std::string symbol() {return std::string("Ti");}
+ static std::string prefix() {return std::string("tebi");}
+};
+
+#if BOOST_RATIO_HAS_UNICODE_SUPPORT
+
+template <>
+struct ratio_string<tebi, char16_t>
+{
+ static std::u16string symbol() {return std::u16string(u"Ti");}
+ static std::u16string prefix() {return std::u16string(u"tebi");}
+};
+
+template <>
+struct ratio_string<tebi, char32_t>
+{
+ static std::u32string symbol() {return std::u32string(U"Ti");}
+ static std::u32string prefix() {return std::u32string(U"tebi");}
+};
+
+#endif
+
+#ifndef BOOST_NO_STD_WSTRING
+template <>
+struct ratio_string<tebi, wchar_t>
+{
+ static std::wstring symbol() {return std::wstring(L"Ti");}
+ static std::wstring prefix() {return std::wstring(L"tebi");}
+};
+#endif
+#endif
+
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
+template <typename CharT>
+struct ratio_string<pebi, CharT> :
+ ratio_detail::ratio_string_static<pebi,CharT>
+{};
+
+#else
+template <>
+struct ratio_string<pebi, char>
+{
+ static std::string symbol() {return std::string("Pi");}
+ static std::string prefix() {return std::string("pebi");}
+};
+
+#if BOOST_RATIO_HAS_UNICODE_SUPPORT
+
+template <>
+struct ratio_string<pebi, char16_t>
+{
+ static std::u16string symbol() {return std::u16string(u"Pi");}
+ static std::u16string prefix() {return std::u16string(u"pebi");}
+};
+
+template <>
+struct ratio_string<pebi, char32_t>
+{
+ static std::u32string symbol() {return std::u32string(U"Pi");}
+ static std::u32string prefix() {return std::u32string(U"pebi");}
+};
+
+#endif
+
+#ifndef BOOST_NO_STD_WSTRING
+template <>
+struct ratio_string<pebi, wchar_t>
+{
+ static std::wstring symbol() {return std::wstring(L"Pi");}
+ static std::wstring prefix() {return std::wstring(L"pebi");}
+};
+#endif
+#endif
+
+#ifdef BOOST_RATIO_HAS_STATIC_STRING
+template <typename CharT>
+struct ratio_string<exbi, CharT> :
+ ratio_detail::ratio_string_static<exbi,CharT>
+{};
+
+#else
+template <>
+struct ratio_string<exbi, char>
+{
+ static std::string symbol() {return std::string("Ei");}
+ static std::string prefix() {return std::string("exbi");}
+};
+
+#if BOOST_RATIO_HAS_UNICODE_SUPPORT
+
+template <>
+struct ratio_string<exbi, char16_t>
+{
+ static std::u16string symbol() {return std::u16string(u"Ei");}
+ static std::u16string prefix() {return std::u16string(u"exbi");}
+};
+
+template <>
+struct ratio_string<exbi, char32_t>
+{
+ static std::u32string symbol() {return std::u32string(U"Ei");}
+ static std::u32string prefix() {return std::u32string(U"exbi");}
+};
+
+#endif
+
+#ifndef BOOST_NO_STD_WSTRING
+template <>
+struct ratio_string<exbi, wchar_t>
+{
+ static std::wstring symbol() {return std::wstring(L"Ei");}
+ static std::wstring prefix() {return std::wstring(L"exbi");}
+};
+#endif
+#endif
+#endif
+
}
#endif // BOOST_RATIO_PROVIDES_DEPRECATED_FEATURES_SINCE_V2_0_0
Modified: trunk/libs/ratio/test/Jamfile.v2
==============================================================================
--- trunk/libs/ratio/test/Jamfile.v2 Sat Nov 9 06:27:55 2013 (r86593)
+++ trunk/libs/ratio/test/Jamfile.v2 2013-11-09 06:47:43 EST (Sat, 09 Nov 2013) (r86594)
@@ -82,6 +82,7 @@
[ compile-fail ratio_arithmetic/ratio_subtract_fail.cpp ]
[ compile-fail ratio_arithmetic/ratio_multiply_fail.cpp ]
[ compile-fail ratio_arithmetic/ratio_divide_fail.cpp ]
+ [ compile ratio_arithmetic/ratio_power_pass.cpp ]
;
test-suite "ratio.comparison"
Added: trunk/libs/ratio/test/ratio_arithmetic/ratio_power_pass.cpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/libs/ratio/test/ratio_arithmetic/ratio_power_pass.cpp 2013-11-09 06:47:43 EST (Sat, 09 Nov 2013) (r86594)
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_power
+
+#define BOOST_RATIO_EXTENSIONS
+#include <boost/ratio/ratio.hpp>
+
+#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+void test()
+{
+ {
+ typedef boost::ratio<1, 2> R1;
+ typedef boost::ratio_power<R1, 1> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 2> R1;
+ typedef boost::ratio_power<R1, -1> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 2 && R::den == 1, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, 2> R1;
+ typedef boost::ratio_power<R1, 0> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 1, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<-1, 2> R1;
+ typedef boost::ratio_power<R1, 2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 4, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<1, -2> R1;
+ typedef boost::ratio_power<R1, 2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 4, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<2, 3> R1;
+ typedef boost::ratio_power<R1, 2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 4 && R::den == 9, NOTHING, ());
+ }
+ {
+ typedef boost::ratio<2, 3> R1;
+ typedef boost::ratio_power<R1, -2> R;
+ BOOST_RATIO_STATIC_ASSERT(R::num == 9 && R::den == 4, NOTHING, ());
+ }
+}
Modified: trunk/libs/ratio/test/ratio_io/ratio_io_pass.cpp
==============================================================================
--- trunk/libs/ratio/test/ratio_io/ratio_io_pass.cpp Sat Nov 9 06:27:55 2013 (r86593)
+++ trunk/libs/ratio/test/ratio_io/ratio_io_pass.cpp 2013-11-09 06:47:43 EST (Sat, 09 Nov 2013) (r86594)
@@ -13,6 +13,7 @@
// test ratio_add
+#define BOOST_RATIO_EXTENSIONS
#include <boost/ratio/ratio_io.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <climits>
@@ -148,7 +149,22 @@
boost::ratio_string<boost::exa, char>::symbol() == "E"
));
}
-// return 1;
+ {
+ BOOST_TEST((
+ boost::ratio_string<boost::kibi, char>::prefix() == "kibi"
+ ));
+ BOOST_TEST((
+ boost::ratio_string<boost::kibi, char>::symbol() == "Ki"
+ ));
+ }
+ {
+ BOOST_TEST((
+ boost::ratio_string<boost::gibi, char>::prefix() == "gibi"
+ ));
+ BOOST_TEST((
+ boost::ratio_string<boost::gibi, char>::symbol() == "Gi"
+ ));
+ }
return boost::report_errors();
}
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