|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r67583 - in trunk/libs/ratio/test: . ratio_extensions
From: vicente.botet_at_[hidden]
Date: 2011-01-02 14:38:42
Author: viboes
Date: 2011-01-02 14:38:41 EST (Sun, 02 Jan 2011)
New Revision: 67583
URL: http://svn.boost.org/trac/boost/changeset/67583
Log:
Boost.Ratio: Added ratio extension test
Added:
trunk/libs/ratio/test/ratio_extensions/
trunk/libs/ratio/test/ratio_extensions/ratio_ext_pass.cpp (contents, props changed)
Text files modified:
trunk/libs/ratio/test/Jamfile.v2 | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
Modified: trunk/libs/ratio/test/Jamfile.v2
==============================================================================
--- trunk/libs/ratio/test/Jamfile.v2 (original)
+++ trunk/libs/ratio/test/Jamfile.v2 2011-01-02 14:38:41 EST (Sun, 02 Jan 2011)
@@ -81,3 +81,7 @@
[ run ../example/display_ex.cpp ]
;
+ test-suite "ratio.ext"
+ :
+ [ run ratio_extensions/ratio_ext_pass.cpp ]
+ ;
Added: trunk/libs/ratio/test/ratio_extensions/ratio_ext_pass.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/ratio/test/ratio_extensions/ratio_ext_pass.cpp 2011-01-02 14:38:41 EST (Sun, 02 Jan 2011)
@@ -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();
+}
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