mirror of
https://github.com/boostorg/ratio.git
synced 2025-05-09 23:24:01 +00:00
Boost.Ratio: Added ratio extension test
[SVN r67583]
This commit is contained in:
parent
a0a2133a9c
commit
30adfec795
@ -81,3 +81,7 @@ project
|
||||
[ run ../example/display_ex.cpp ]
|
||||
;
|
||||
|
||||
test-suite "ratio.ext"
|
||||
:
|
||||
[ run ratio_extensions/ratio_ext_pass.cpp ]
|
||||
;
|
||||
|
24
test/ratio_extensions/ratio_ext_pass.cpp
Normal file
24
test/ratio_extensions/ratio_ext_pass.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
// 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.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
boost::intmax_t func(boost::ratio<5,6> s) {
|
||||
return s.num;
|
||||
}
|
||||
|
||||
void test() {
|
||||
BOOST_TEST((
|
||||
func(boost::ratio<10,12>() )==5
|
||||
));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user