ratio_ext_pass.cpp 611 B

123456789101112131415161718192021222324252627282930
  1. // Copyright 2011 Vicente J. Botet Escriba
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // See http://www.boost.org/LICENSE_1_0.txt
  4. // test ratio: equivalent ratios convert with BOOST_RATIO_EXTENSIONS
  5. #define BOOST_RATIO_EXTENSIONS
  6. #include <boost/ratio/ratio.hpp>
  7. #include <boost/core/lightweight_test.hpp>
  8. boost::intmax_t func(boost::ratio<5,6> s);
  9. boost::intmax_t func(boost::ratio<5,6> s) {
  10. return s.num;
  11. }
  12. void test();
  13. void test() {
  14. boost::ratio<10,12> r;
  15. BOOST_TEST((
  16. func(r)==5
  17. ));
  18. }
  19. int main()
  20. {
  21. test();
  22. return boost::report_errors();
  23. }