early-access version 3088

This commit is contained in:
pineappleEA
2022-11-05 15:35:56 +01:00
parent 4e4fc25ce3
commit b601909c6d
35519 changed files with 5996896 additions and 860 deletions

View File

@@ -0,0 +1,59 @@
# Copyright 2019 Mike Dev
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
#
# NOTE: CMake support for Boost.Ratio is currently experimental at best
# and this file runs only a subset of the unit tests
# (in particular none of the fail tests)
# Attach all our tests to the `tests` target, to enable
# `cmake --build . --target tests`
if(NOT TARGET tests)
add_custom_target(tests)
endif()
## unit tests
# list of tests that contain a main function
set( exec_test_files ratio_ext_pass;ratio_io_pass;ratio_pass )
file( GLOB_RECURSE test_files *_pass.cpp )
foreach( file IN LISTS test_files )
get_filename_component( core_name ${file} NAME_WE )
set( test_name boost_ratio-test-${core_name} )
if( ${core_name} IN_LIST exec_test_files )
add_executable( ${test_name} EXCLUDE_FROM_ALL ${file} )
add_test( NAME ${test_name} COMMAND ${test_name} )
else()
# most tests are compile only, so we just need to create an object file
# in order to see, if it compiles
add_library( ${test_name} STATIC EXCLUDE_FROM_ALL ${file})
endif()
add_dependencies(tests ${test_name})
target_link_libraries( ${test_name} PUBLIC
Boost::ratio
)
endforeach()
## examples
file( GLOB_RECURSE test_files ../example/*.cpp )
foreach( file IN LISTS test_files )
get_filename_component( core_name ${file} NAME_WE )
set( test_name boost_ratio-example-${core_name} )
add_executable( ${test_name} EXCLUDE_FROM_ALL ${file} )
target_link_libraries( ${test_name} PUBLIC
Boost::ratio Boost::chrono
)
add_dependencies(tests ${test_name})
add_test( NAME ${test_name} COMMAND ${test_name} )
endforeach()

View File

@@ -0,0 +1,132 @@
# Boost Ratio Library test Jamfile
# Copyright Beman Dawes 2003, 2006, 2008
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt
# See library home page at http://www.boost.org/libs/ratio
# uncomment one if the above lines if you build outside the Boost release
#local BOOST_ROOT = /boost_1_41_0 ;
#local BOOST_ROOT = c:/cygwin/boost_1_41_0 ;
if ! $(BOOST_ROOT)
{
BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
}
project
: requirements
#<os>LINUX:<threading>multi
# uncomment the line above if you build outside the Boost release
#<include>$(BOOST_ROOT)
# uncomment the line above if you build outside the Boost release
#<include>../../..
<toolset>msvc:<asynch-exceptions>on
<define>BOOST_ENABLE_WARNINGS
<define>BOOST_RATIO_USES_MPL_ASSERT
<define>BOOST_RATIO_VERSION=2
<define>BOOST_MPL_NEXT_PRIOR_EXT
#<toolset>sun:<define>BOOST_COMMON_TYPE_DONT_USE_TYPEOF
#<toolset>sun:<define>BOOST_TYPEOF_EMULATION
<toolset>sun:<define>__typeof__=__typeof__
<warnings>all
<toolset>gcc:<cxxflags>-Wextra
<toolset>gcc:<cxxflags>-Wno-long-long
<toolset>gcc:<cxxflags>-pedantic
<toolset>darwin:<cxxflags>-Wextra
<toolset>darwin:<cxxflags>-Wno-long-long
<toolset>darwin:<cxxflags>-pedantic
#<toolset>pathscale:<cxxflags>-Wextra
<toolset>pathscale:<cxxflags>-Wno-long-long
<toolset>pathscale:<cxxflags>-pedantic
<toolset>clang:<cxxflags>-Wextra
<toolset>clang:<cxxflags>-pedantic
<toolset>clang:<cxxflags>-Wno-long-long
#<toolset>gcc-mingw-4.5.0:<cxxflags>-Wno-missing-field-initializers
#<toolset>gcc-mingw-4.5.0:<cxxflags>-fdiagnostics-show-option
#<toolset>gcc-mingw-4.6.0:<cxxflags>-fdiagnostics-show-option
<toolset>msvc:<cxxflags>/wd4127
# Note: Some of the remarks from the Intel compiler are disabled
# remark #1418: external function definition with no prior declaration
# remark #304: access control not specified ("public" by default)
<toolset>intel:<cxxflags>-wd304,1418
;
test-suite "ratio_ratio"
:
[ 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 ]
[ compile ratio_arithmetic/ratio_negate_pass.cpp ]
[ compile ratio_arithmetic/ratio_sign_pass.cpp ]
[ compile ratio_arithmetic/ratio_abs_pass.cpp ]
[ compile ratio_arithmetic/ratio_power_pass.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"
:
[ run ../example/si_physics.cpp ]
[ run ../example/display_ex.cpp ]
;
test-suite "ratio_ext"
:
[ run ratio_extensions/ratio_ext_pass.cpp ]
[ compile ratio_extensions/mpl_plus_pass.cpp ]
[ 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 ]
[ compile ratio_extensions/mpl_less_equal_pass.cpp ]
[ compile ratio_extensions/mpl_greater_pass.cpp ]
[ compile ratio_extensions/mpl_greater_equal_pass.cpp ]
[ compile ratio_extensions/mpl_arithmetic_pass.cpp ]
[ compile ratio_extensions/mpl_comparison_pass.cpp ]
[ compile ratio_extensions/mpl_rational_constant_pass.cpp ]
;
#test-suite "tickets"
# :
# [ run test_6498_pass.cpp ]
# ;

View File

@@ -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 ratio_abs
#define BOOST_RATIO_EXTENSIONS
#include <boost/ratio/ratio.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
void test()
{
{
typedef boost::ratio<0> R1;
typedef boost::ratio_abs<R1> R;
BOOST_RATIO_STATIC_ASSERT(R::num == 0 && R::den == 1, NOTHING, ());
}
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio_abs<R1> R;
BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 1, NOTHING, ());
}
{
typedef boost::ratio<1, 2> R1;
typedef boost::ratio_abs<R1> R;
BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ());
}
{
typedef boost::ratio<-1, 2> R1;
typedef boost::ratio_abs<R1> R;
BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ());
}
{
typedef boost::ratio<1, -2> R1;
typedef boost::ratio_abs<R1> R;
BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ());
}
}

View File

@@ -0,0 +1,28 @@
//===----------------------------------------------------------------------===//
//
// 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.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<boost::ratio<1,2>,boost::ratio<1,3> > >::value == 1)
, NOTHING, ());

View File

@@ -0,0 +1,36 @@
//===----------------------------------------------------------------------===//
//
// 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.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
>()
);
}

View File

@@ -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/ratio.hpp>
#include <boost/integer_traits.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
typedef boost::ratio<boost::integer_traits<boost::intmax_t>::const_max, 1> R1;
typedef boost::ratio<1, 1> R2;
typedef boost::ratio_add<R1, R2>::type RT;
BOOST_RATIO_STATIC_ASSERT(RT::num==boost::integer_traits<boost::intmax_t>::const_max+1, NOTHING, (RT));
BOOST_RATIO_STATIC_ASSERT(RT::den==1, NOTHING, (RT));

View File

@@ -0,0 +1,95 @@
//===----------------------------------------------------------------------===//
//
// 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.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
void test()
{
{
typedef boost::ratio<0> R1;
typedef boost::ratio<0> R2;
typedef boost::ratio_add<R1, R2> R;
BOOST_RATIO_STATIC_ASSERT(R::num == 0 && R::den == 1, NOTHING, ());
}
{
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, ());
}
{
typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
typedef boost::ratio<-1, 1> R2;
typedef boost::ratio_add<R1, R2>::type RT;
}
}
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>
>
()
);
}

View File

@@ -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/ratio.hpp>
typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
typedef boost::ratio<1,2> R2;
typedef boost::ratio_divide<R1, R2>::type RT;

View File

@@ -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/ratio.hpp>
#if !defined(BOOST_NO_CXX11_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, ());
}
}

View File

@@ -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/ratio.hpp>
typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
typedef boost::ratio<2,1> R2;
typedef boost::ratio_multiply<R1, R2>::type RT;

View File

@@ -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/ratio.hpp>
#if !defined(BOOST_NO_CXX11_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, ());
}
}

View File

@@ -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 ratio_negate
#define BOOST_RATIO_EXTENSIONS
#include <boost/ratio/ratio.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
void test()
{
{
typedef boost::ratio<0> R1;
typedef boost::ratio_negate<R1> R;
BOOST_RATIO_STATIC_ASSERT(R::num == 0 && R::den == 1, NOTHING, ());
}
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio_negate<R1> R;
BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 1, NOTHING, ());
}
{
typedef boost::ratio<1, 2> R1;
typedef boost::ratio_negate<R1> R;
BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ());
}
{
typedef boost::ratio<-1, 2> R1;
typedef boost::ratio_negate<R1> R;
BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ());
}
{
typedef boost::ratio<1, -2> R1;
typedef boost::ratio_negate<R1> R;
BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ());
}
}

View File

@@ -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, ());
}
}

View File

@@ -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 ratio_sign
#define BOOST_RATIO_EXTENSIONS
#include <boost/ratio/ratio.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
void test()
{
{
typedef boost::ratio<0> R1;
typedef boost::ratio_sign<R1> R;
BOOST_RATIO_STATIC_ASSERT(R::value == 0, NOTHING, ());
}
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio_sign<R1> R;
BOOST_RATIO_STATIC_ASSERT(R::value == 1, NOTHING, ());
}
{
typedef boost::ratio<1, 2> R1;
typedef boost::ratio_sign<R1> R;
BOOST_RATIO_STATIC_ASSERT(R::value == 1, NOTHING, ());
}
{
typedef boost::ratio<-1, 2> R1;
typedef boost::ratio_sign<R1> R;
BOOST_RATIO_STATIC_ASSERT(R::value == -1, NOTHING, ());
}
{
typedef boost::ratio<1, -2> R1;
typedef boost::ratio_sign<R1> R;
BOOST_RATIO_STATIC_ASSERT(R::value == -1, NOTHING, ());
}
}

View File

@@ -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/ratio.hpp>
typedef boost::ratio<BOOST_RATIO_INTMAX_C(-0x7FFFFFFFFFFFFFFF), 1> R1;
typedef boost::ratio<1,1> R2;
typedef boost::ratio_subtract<R1, R2>::type RT;

View File

@@ -0,0 +1,72 @@
//===----------------------------------------------------------------------===//
//
// 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/ratio.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
void test()
{
{
typedef boost::ratio<0> R1;
typedef boost::ratio<0> R2;
typedef boost::ratio_subtract<R1, R2> R;
BOOST_RATIO_STATIC_ASSERT(R::num == 0 && R::den == 1, NOTHING, ());
}
{
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, ());
}
}

View File

@@ -0,0 +1,64 @@
//===----------------------------------------------------------------------===//
//
// 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/ratio.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
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, ());
}
}

View File

@@ -0,0 +1,67 @@
//===----------------------------------------------------------------------===//
//
// 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.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
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 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<-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, ());
}
}

View File

@@ -0,0 +1,61 @@
//===----------------------------------------------------------------------===//
//
// 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.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
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, ());
}
}

View File

@@ -0,0 +1,61 @@
//===----------------------------------------------------------------------===//
//
// 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.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
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, ());
}
}

View File

@@ -0,0 +1,91 @@
//===----------------------------------------------------------------------===//
//
// 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.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
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, ());
}
}

View File

@@ -0,0 +1,61 @@
//===----------------------------------------------------------------------===//
//
// 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.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
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, ());
}
}

View File

@@ -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_CXX11_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, ());
}
}

View File

@@ -0,0 +1,13 @@
//===----------------------------------------------------------------------===//
// Copyright 2011 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/mpl/arithmetic.hpp>
void test()
{
}

View File

@@ -0,0 +1,13 @@
//===----------------------------------------------------------------------===//
// Copyright 2011 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/mpl/comparison.hpp>
void test()
{
}

View File

@@ -0,0 +1,67 @@
//===----------------------------------------------------------------------===//
//
// 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::divides
#define BOOST_RATIO_EXTENSIONS
#include <boost/ratio/mpl/divides.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
void test()
{
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio<1, 1> R2;
typedef boost::mpl::divides<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::mpl::divides<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::mpl::divides<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::mpl::divides<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::mpl::divides<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::mpl::divides<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::mpl::divides<R1, R2> R;
BOOST_RATIO_STATIC_ASSERT(R::num == 630992477165LL && R::den == 127339199162436LL, NOTHING, ());
}
}

View File

@@ -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 mpl::equal_to
#define BOOST_RATIO_EXTENSIONS
#include <boost/ratio/mpl/equal_to.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
void test()
{
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio<1, 1> R2;
BOOST_RATIO_STATIC_ASSERT((boost::mpl::equal_to<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::mpl::equal_to<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::mpl::equal_to<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::mpl::equal_to<R1, R2>::value), NOTHING, ());
}
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio<1, -1> R2;
BOOST_RATIO_STATIC_ASSERT((!boost::mpl::equal_to<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::mpl::equal_to<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::mpl::equal_to<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::mpl::equal_to<R1, R2>::value), NOTHING, ());
}
}

View File

@@ -0,0 +1,69 @@
//===----------------------------------------------------------------------===//
//
// 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/mpl/greater_equal.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
void test()
{
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio<1, 1> R2;
BOOST_RATIO_STATIC_ASSERT((boost::mpl::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::mpl::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::mpl::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::mpl::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::mpl::greater_equal<R1, R2>::value), NOTHING, ());
}
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio<1, -1> R2;
BOOST_RATIO_STATIC_ASSERT((boost::mpl::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::mpl::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::mpl::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::mpl::greater_equal<R1, R2>::value), NOTHING, ());
}
}

View File

@@ -0,0 +1,63 @@
//===----------------------------------------------------------------------===//
//
// 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/mpl/greater.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
void test()
{
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio<1, 1> R2;
BOOST_RATIO_STATIC_ASSERT((!boost::mpl::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::mpl::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::mpl::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::mpl::greater<R1, R2>::value), NOTHING, ());
}
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio<1, -1> R2;
BOOST_RATIO_STATIC_ASSERT((boost::mpl::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::mpl::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::mpl::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::mpl::greater<R1, R2>::value), NOTHING, ());
}
}

View File

@@ -0,0 +1,63 @@
//===----------------------------------------------------------------------===//
//
// 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/mpl/less_equal.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
void test()
{
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio<1, 1> R2;
BOOST_RATIO_STATIC_ASSERT((boost::mpl::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::mpl::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::mpl::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::mpl::less_equal<R1, R2>::value), NOTHING, ());
}
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio<1, -1> R2;
BOOST_RATIO_STATIC_ASSERT((!boost::mpl::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::mpl::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::mpl::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::mpl::less_equal<R1, R2>::value), NOTHING, ());
}
}

View File

@@ -0,0 +1,93 @@
//===----------------------------------------------------------------------===//
//
// 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/mpl/less.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
void test()
{
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio<1, 1> R2;
BOOST_RATIO_STATIC_ASSERT((!boost::mpl::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::mpl::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::mpl::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::mpl::less<R1, R2>::value), NOTHING, ());
}
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio<1, -1> R2;
BOOST_RATIO_STATIC_ASSERT((!boost::mpl::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::mpl::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::mpl::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::mpl::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::mpl::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::mpl::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::mpl::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::mpl::less<R1, R2>::value), NOTHING, ());
}
{
typedef boost::ratio<641981, 1339063> R1;
typedef boost::ratio<1291640, 2694141LL> R2;
BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ());
}
{
typedef boost::ratio<1291640, 2694141LL> R1;
typedef boost::ratio<641981, 1339063> R2;
BOOST_RATIO_STATIC_ASSERT((boost::mpl::less<R1, R2>::value), NOTHING, ());
}
}

View File

@@ -0,0 +1,68 @@
//===----------------------------------------------------------------------===//
//
// 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::minus
#define BOOST_RATIO_EXTENSIONS
#include <boost/ratio/mpl/minus.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
void test()
{
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio<1, 1> R2;
typedef boost::mpl::minus<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::mpl::minus<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::mpl::minus<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::mpl::minus<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::mpl::minus<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::mpl::minus<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::mpl::minus<R1, R2> R;
BOOST_RATIO_STATIC_ASSERT(R::num == -126708206685271LL && R::den == 5177331081415LL, NOTHING, ());
}
}

View File

@@ -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_CXX11_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, ());
}
}

View File

@@ -0,0 +1,63 @@
//===----------------------------------------------------------------------===//
//
// 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/mpl/not_equal_to.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
void test()
{
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio<1, 1> R2;
BOOST_RATIO_STATIC_ASSERT((!boost::mpl::not_equal_to<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::mpl::not_equal_to<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::mpl::not_equal_to<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::mpl::not_equal_to<R1, R2>::value), NOTHING, ());
}
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio<1, -1> R2;
BOOST_RATIO_STATIC_ASSERT((boost::mpl::not_equal_to<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::mpl::not_equal_to<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::mpl::not_equal_to<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::mpl::not_equal_to<R1, R2>::value), NOTHING, ());
}
}

View File

@@ -0,0 +1,97 @@
//===----------------------------------------------------------------------===//
//
// 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::plus
#define BOOST_RATIO_EXTENSIONS
#include <boost/ratio/mpl/plus.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
void test()
{
{
typedef boost::ratio<1, 1> R1;
typedef boost::mpl::int_<1> R2;
typedef boost::mpl::plus<R1, R2> R;
BOOST_RATIO_STATIC_ASSERT(R::num == 2 && R::den == 1, NOTHING, ());
typedef boost::mpl::plus<R, R2> RR;
BOOST_RATIO_STATIC_ASSERT(RR::num == 3 && RR::den == 1, NOTHING, ());
}
{
typedef boost::mpl::int_<1> R1;
typedef boost::ratio<1, 2> R2;
typedef boost::mpl::plus<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::mpl::int_<0> R3;
typedef boost::mpl::plus<R1, R2, R3> 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::mpl::int_<0> R3;
typedef boost::mpl::plus<R1, R2, R3> 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::mpl::int_<0> R3;
typedef boost::mpl::plus<R1, R2, R3> 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::mpl::int_<0> R3;
typedef boost::mpl::plus<R1, R2, R3> 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::mpl::int_<0> R3;
typedef boost::mpl::plus<R1, R2, R3> R;
BOOST_RATIO_STATIC_ASSERT(R::num == 127970191639601LL && R::den == 5177331081415LL, NOTHING, ());
}
{
typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
typedef boost::ratio<-1, 1> R2;
typedef boost::mpl::int_<0> R3;
typedef boost::mpl::plus<R1, R2, R3>::type RT;
}
}
boost::intmax_t func(boost::ratio<5,6> s) {
return s.num;
}
boost::intmax_t test_conversion() {
return func(
boost::mpl::plus<
boost::ratio<1,2>,
boost::ratio<1,3>
>
()
);
}

View File

@@ -0,0 +1,13 @@
//===----------------------------------------------------------------------===//
// Copyright 2011 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/mpl/comparison.hpp>
void test()
{
}

View File

@@ -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_CXX11_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, ());
}
}

View File

@@ -0,0 +1,67 @@
//===----------------------------------------------------------------------===//
//
// 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::times
#define BOOST_RATIO_EXTENSIONS
#include <boost/ratio/mpl/times.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
void test()
{
{
typedef boost::ratio<1, 1> R1;
typedef boost::ratio<1, 1> R2;
typedef boost::mpl::times<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::mpl::times<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::mpl::times<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::mpl::times<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::mpl::times<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::mpl::times<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::mpl::times<R1, R2> R;
BOOST_RATIO_STATIC_ASSERT(R::num == 15519594064236LL && R::den == 5177331081415LL, NOTHING, ());
}
}

View File

@@ -0,0 +1,30 @@
// Copyright 2011 Vicente J. Botet Escriba
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// test ratio: equivalent ratios convert with BOOST_RATIO_EXTENSIONS
#define BOOST_RATIO_EXTENSIONS
#include <boost/ratio/ratio.hpp>
#include <boost/core/lightweight_test.hpp>
boost::intmax_t func(boost::ratio<5,6> s);
boost::intmax_t func(boost::ratio<5,6> s) {
return s.num;
}
void test();
void test() {
boost::ratio<10,12> r;
BOOST_TEST((
func(r)==5
));
}
int main()
{
test();
return boost::report_errors();
}

View File

@@ -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::symbol();
}

View File

@@ -0,0 +1,171 @@
//===----------------------------------------------------------------------===//
//
// 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
#define BOOST_RATIO_EXTENSIONS
#include <boost/ratio/ratio_io.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <climits>
int main()
{
{
BOOST_TEST((
boost::ratio_string<boost::atto, char>::prefix() == "atto"
));
BOOST_TEST((
boost::ratio_string<boost::atto, char>::symbol() == "a"
));
}
{
BOOST_TEST((
boost::ratio_string<boost::femto, char>::prefix() == "femto"
));
BOOST_TEST((
boost::ratio_string<boost::femto, char>::symbol() == "f"
));
}
{
BOOST_TEST((
boost::ratio_string<boost::pico, char>::prefix() == "pico"
));
BOOST_TEST((
boost::ratio_string<boost::pico, char>::symbol() == "p"
));
}
{
BOOST_TEST((
boost::ratio_string<boost::nano, char>::prefix() == "nano"
));
BOOST_TEST((
boost::ratio_string<boost::nano, char>::symbol() == "n"
));
}
{
BOOST_TEST((
boost::ratio_string<boost::micro, char>::prefix() == "micro"
));
BOOST_TEST((
boost::ratio_string<boost::micro, char>::symbol() == "\xC2\xB5"
));
}
{
BOOST_TEST((
boost::ratio_string<boost::milli, char>::prefix() == "milli"
));
BOOST_TEST((
boost::ratio_string<boost::milli, char>::symbol() == "m"
));
}
{
BOOST_TEST((
boost::ratio_string<boost::centi, char>::prefix() == "centi"
));
BOOST_TEST((
boost::ratio_string<boost::centi, char>::symbol() == "c"
));
}
{
BOOST_TEST((
boost::ratio_string<boost::deci, char>::prefix() == "deci"
));
BOOST_TEST((
boost::ratio_string<boost::deci, char>::symbol() == "d"
));
}
{
BOOST_TEST((
boost::ratio_string<boost::deca, char>::prefix() == "deca"
));
BOOST_TEST((
boost::ratio_string<boost::deca, char>::symbol() == "da"
));
}
{
BOOST_TEST((
boost::ratio_string<boost::hecto, char>::prefix() == "hecto"
));
BOOST_TEST((
boost::ratio_string<boost::hecto, char>::symbol() == "h"
));
}
{
BOOST_TEST((
boost::ratio_string<boost::kilo, char>::prefix() == "kilo"
));
BOOST_TEST((
boost::ratio_string<boost::kilo, char>::symbol() == "k"
));
}
{
BOOST_TEST((
boost::ratio_string<boost::mega, char>::prefix() == "mega"
));
BOOST_TEST((
boost::ratio_string<boost::mega, char>::symbol() == "M"
));
}
{
BOOST_TEST((
boost::ratio_string<boost::giga, char>::prefix() == "giga"
));
BOOST_TEST((
boost::ratio_string<boost::giga, char>::symbol() == "G"
));
}
{
BOOST_TEST((
boost::ratio_string<boost::tera, char>::prefix() == "tera"
));
BOOST_TEST((
boost::ratio_string<boost::tera, char>::symbol() == "T"
));
}
{
BOOST_TEST((
boost::ratio_string<boost::peta, char>::prefix() == "peta"
));
BOOST_TEST((
boost::ratio_string<boost::peta, char>::symbol() == "P"
));
}
{
BOOST_TEST((
boost::ratio_string<boost::exa, char>::prefix() == "exa"
));
BOOST_TEST((
boost::ratio_string<boost::exa, char>::symbol() == "E"
));
}
{
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();
}

View File

@@ -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/ratio.hpp>
#include <boost/cstdint.hpp>
void test()
{
const boost::intmax_t t1 = boost::ratio<1, 0>::num;
(void)t1;
}

View File

@@ -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/ratio.hpp>
#include <cstdint>
void test()
{
const boost::intmax_t t1 = boost::ratio<0x8000000000000000ULL, 1>::num;
(void)t1;
}

View File

@@ -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/ratio.hpp>
#include <boost/cstdint.hpp>
void test()
{
const boost::intmax_t t1 = boost::ratio<1, 0x8000000000000000ULL>::num;
(void)t1;
}

View File

@@ -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/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>());
}

View File

@@ -0,0 +1,56 @@
//===----------------------------------------------------------------------===//
//
// 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/ratio.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
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>();
}

View File

@@ -0,0 +1,36 @@
// ratio_test.cpp ----------------------------------------------------------//
// Copyright 2008 Howard Hinnant
// Copyright 2008 Beman Dawes
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#include <boost/ratio/ratio.hpp>
#include <iostream>
typedef boost::ratio<5, 3> five_thirds; // five_thirds::num == 5, five_thirds::den == 3
typedef boost::ratio<25, 15> also_five_thirds; // also_five_thirds::num == 5, also_five_thirds::den == 3
typedef boost::ratio_divide<five_thirds, also_five_thirds>::type one; // one::num == 1, one::den == 1
typedef boost::ratio_multiply<boost::ratio<5>, boost::giga>::type _5giga; // _5giga::num == 5000000000, _5giga::den == 1
typedef boost::ratio_multiply<boost::ratio<5>, boost::nano>::type _5nano; // _5nano::num == 1, _5nano::den == 200000000
// Test the case described in library working group issue 948.
typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, BOOST_RATIO_INTMAX_T_MAX-16> R1;
typedef boost::ratio<8, 7> R2;
typedef boost::ratio_multiply<R1, R2>::type RT;
int main()
{
typedef boost::ratio<8, BOOST_RATIO_INTMAX_C(0x7FFFFFFFD)> R1;
typedef boost::ratio<3, BOOST_RATIO_INTMAX_C(0x7FFFFFFFD)> R2;
typedef boost::ratio_subtract<R1, R2>::type RS;
std::cout << RS::num << '/' << RS::den << '\n';
return 0;
}

View File

@@ -0,0 +1,40 @@
# Copyright 2018 Mike Dev
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5)
# NOTE: Individual boost cmake files might require a higher cmake version
project(boost LANGUAGES CXX)
#=== options ===
# Some libraries' cmake files don't work well with this cmake file, e.g. because
# - they are generally not designed to support the add_subdirectory workflow at all
# - they define targets with conflicting names (e.g. check)
# - require some additional (internal or external) dependencies
#
# Those libraries can be excluded here
set(BOOST_RATIO_IGNORE_LIBS callable_traits;hof;compute;gil;hana;yap;safe_numerics;beast CACHE STRING "List of libraries that will be excluded from cmake build")
#~~~ options ~~~
message(STATUS "[Boost] Excluded libs (BOOST_RATIO_IGNORE_LIBS): ${BOOST_RATIO_IGNORE_LIBS}")
# cmake doesn't require autolinking and currently most cmake files don't produce
# name mangled libraries anyway
add_definitions(-DBOOST_ALL_NO_LIB)
enable_testing()
# Detect and process all CMakeLists files that reside in the root folder of a library
file(GLOB boost_libs_with_cmake_files ../../../../libs/*/CMakeLists.txt)
foreach(cmake_file IN LISTS boost_libs_with_cmake_files)
get_filename_component(dir ${cmake_file} DIRECTORY)
get_filename_component(lib_name ${dir} NAME)
if(NOT lib_name IN_LIST BOOST_RATIO_IGNORE_LIBS)
add_subdirectory(${dir} ${lib_name})
endif()
endforeach()

View File

@@ -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/ratio.hpp>
#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
#define NOTHING ""
#endif
BOOST_RATIO_STATIC_ASSERT(boost::atto::num == 1 && boost::atto::den == 1000000000000000000ULL, NOTHING, (boost::mpl::integral_c<boost::intmax_t,boost::atto::den>));
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::mpl::integral_c<boost::intmax_t,boost::deca::den>));
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, ());