|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r68808 - trunk/libs/random/test
From: steven_at_[hidden]
Date: 2011-02-12 10:48:52
Author: steven_watanabe
Date: 2011-02-12 10:48:51 EST (Sat, 12 Feb 2011)
New Revision: 68808
URL: http://svn.boost.org/trac/boost/changeset/68808
Log:
Use INT64_C where appropriate. This should fix some vacpp and gcc 3.4.6 errors.
Text files modified:
trunk/libs/random/test/test_const_mod.cpp | 55 +++++++++++++++++++++------------------
trunk/libs/random/test/test_ranlux64_3.cpp | 3 +
trunk/libs/random/test/test_ranlux64_4.cpp | 3 +
3 files changed, 34 insertions(+), 27 deletions(-)
Modified: trunk/libs/random/test/test_const_mod.cpp
==============================================================================
--- trunk/libs/random/test/test_const_mod.cpp (original)
+++ trunk/libs/random/test/test_const_mod.cpp 2011-02-12 10:48:51 EST (Sat, 12 Feb 2011)
@@ -11,6 +11,7 @@
#include <boost/random/detail/const_mod.hpp>
+#include <boost/cstdint.hpp>
#include <boost/mpl/vector.hpp>
#define BOOST_TEST_MAIN
@@ -138,41 +139,45 @@
> int64_types;
BOOST_AUTO_TEST_CASE_TEMPLATE(test_mult64, IntType, int64_types) {
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::mult(0, 0)), 0);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::mult(0, 2147483562)), 0);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::mult(2147483562, 0)), 0);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::mult(2147483562, 2147483562)), 316718521754730848);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::mult(1234567890, 1234657890)), 1524268986129152100);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::mult(1234567890726352938, 1234657890736453927)), 88656187017794672);
+ typedef boost::random::const_mod<IntType, INT64_C(2147483563652738498)> const_mod_type;
+ BOOST_CHECK_EQUAL((const_mod_type::mult(0, 0)), 0);
+ BOOST_CHECK_EQUAL((const_mod_type::mult(0, 2147483562)), 0);
+ BOOST_CHECK_EQUAL((const_mod_type::mult(2147483562, 0)), 0);
+ BOOST_CHECK_EQUAL((const_mod_type::mult(2147483562, 2147483562)), INT64_C(316718521754730848));
+ BOOST_CHECK_EQUAL((const_mod_type::mult(1234567890, 1234657890)), INT64_C(1524268986129152100));
+ BOOST_CHECK_EQUAL((const_mod_type::mult(INT64_C(1234567890726352938), INT64_C(1234657890736453927))), INT64_C(88656187017794672));
}
BOOST_AUTO_TEST_CASE_TEMPLATE(test_add64, IntType, int64_types) {
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::add(0, 0)), 0);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::add(0, 2147483562)), 2147483562);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::add(2147483562, 0)), 2147483562);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::add(2147483562, 2147483562)), 4294967124);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::add(1234567890, 1234657890)), 2469225780);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::add(1234567890726352938, 1234657890736453927)), 321742217810068367);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::add(2147483563652738490, 8)), 0);
+ typedef boost::random::const_mod<IntType, INT64_C(2147483563652738498)> const_mod_type;
+ BOOST_CHECK_EQUAL((const_mod_type::add(0, 0)), 0);
+ BOOST_CHECK_EQUAL((const_mod_type::add(0, 2147483562)), 2147483562);
+ BOOST_CHECK_EQUAL((const_mod_type::add(2147483562, 0)), 2147483562);
+ BOOST_CHECK_EQUAL((const_mod_type::add(2147483562, 2147483562)), 4294967124);
+ BOOST_CHECK_EQUAL((const_mod_type::add(1234567890, 1234657890)), 2469225780);
+ BOOST_CHECK_EQUAL((const_mod_type::add(INT64_C(1234567890726352938), INT64_C(1234657890736453927))), INT64_C(321742217810068367));
+ BOOST_CHECK_EQUAL((const_mod_type::add(INT64_C(2147483563652738490), 8)), 0);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(test_mult_add64, IntType, int64_types) {
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::mult_add(0, 0, 0)), 0);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::mult_add(0, 2147483562, 827364)), 827364);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::mult_add(2147483562, 0, 827364)), 827364);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::mult_add(2147483562, 2147483562, 2147483562)), 316718523902214410);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::mult_add(1234567890, 1234657890, 1726384759)), 1524268987855536859);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::mult_add(1234567890726352938, 1234657890736453927, 1726384759726488649)), 1815040946744283321);
+ typedef boost::random::const_mod<IntType, INT64_C(2147483563652738498)> const_mod_type;
+ BOOST_CHECK_EQUAL((const_mod_type::mult_add(0, 0, 0)), 0);
+ BOOST_CHECK_EQUAL((const_mod_type::mult_add(0, 2147483562, 827364)), 827364);
+ BOOST_CHECK_EQUAL((const_mod_type::mult_add(2147483562, 0, 827364)), 827364);
+ BOOST_CHECK_EQUAL((const_mod_type::mult_add(2147483562, 2147483562, 2147483562)), INT64_C(316718523902214410));
+ BOOST_CHECK_EQUAL((const_mod_type::mult_add(1234567890, 1234657890, 1726384759)), INT64_C(1524268987855536859));
+ BOOST_CHECK_EQUAL((const_mod_type::mult_add(INT64_C(1234567890726352938), INT64_C(1234657890736453927), INT64_C(1726384759726488649))), INT64_C(1815040946744283321));
}
BOOST_AUTO_TEST_CASE_TEMPLATE(test_invert64, IntType, int64_types) {
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::invert(0)), 0);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::mult_add(0, 0, 0)), 0);
+ typedef boost::random::const_mod<IntType, INT64_C(2147483563652738498)> const_mod_type;
+ BOOST_CHECK_EQUAL((const_mod_type::invert(0)), 0);
+ BOOST_CHECK_EQUAL((const_mod_type::mult_add(0, 0, 0)), 0);
IntType inverse;
- inverse = boost::random::const_mod<IntType, 2147483563652738498>::invert(7362947769);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::mult(7362947769, inverse)), 1);
- inverse = boost::random::const_mod<IntType, 2147483563652738498>::invert(1263142436887493875);
- BOOST_CHECK_EQUAL((boost::random::const_mod<IntType, 2147483563652738498>::mult(1263142436887493875, inverse)), 1);
+ inverse = const_mod_type::invert(INT64_C(7362947769));
+ BOOST_CHECK_EQUAL((const_mod_type::mult(INT64_C(7362947769), inverse)), 1);
+ inverse = const_mod_type::invert(INT64_C(1263142436887493875));
+ BOOST_CHECK_EQUAL((const_mod_type::mult(INT64_C(1263142436887493875), inverse)), 1);
}
#endif
Modified: trunk/libs/random/test/test_ranlux64_3.cpp
==============================================================================
--- trunk/libs/random/test/test_ranlux64_3.cpp (original)
+++ trunk/libs/random/test/test_ranlux64_3.cpp 2011-02-12 10:48:51 EST (Sat, 12 Feb 2011)
@@ -10,10 +10,11 @@
*/
#include <boost/random/ranlux.hpp>
+#include <boost/cstdint.hpp>
#include <cmath>
#define BOOST_RANDOM_URNG boost::random::ranlux64_3
// principal operation validated with CLHEP, values by experiment
-#define BOOST_RANDOM_VALIDATION_VALUE 141789170949364
+#define BOOST_RANDOM_VALIDATION_VALUE INT64_C(141789170949364)
#include "test_generator.ipp"
Modified: trunk/libs/random/test/test_ranlux64_4.cpp
==============================================================================
--- trunk/libs/random/test/test_ranlux64_4.cpp (original)
+++ trunk/libs/random/test/test_ranlux64_4.cpp 2011-02-12 10:48:51 EST (Sat, 12 Feb 2011)
@@ -10,10 +10,11 @@
*/
#include <boost/random/ranlux.hpp>
+#include <boost/cstdint.hpp>
#include <cmath>
#define BOOST_RANDOM_URNG boost::random::ranlux64_4
// principal operation validated with CLHEP, values by experiment
-#define BOOST_RANDOM_VALIDATION_VALUE 199461971133682
+#define BOOST_RANDOM_VALIDATION_VALUE INT64_C(199461971133682)
#include "test_generator.ipp"
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