|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r64412 - sandbox/SOC/2010/bits_and_ints/libs/integer/test
From: muriloufg_at_[hidden]
Date: 2010-07-28 10:54:15
Author: murilov
Date: 2010-07-28 10:54:11 EDT (Wed, 28 Jul 2010)
New Revision: 64412
URL: http://svn.boost.org/trac/boost/changeset/64412
Log:
Added test for round_right function
Text files modified:
sandbox/SOC/2010/bits_and_ints/libs/integer/test/find_first_one_string_test.cpp | 12 ++++----
sandbox/SOC/2010/bits_and_ints/libs/integer/test/rotate_test.cpp | 49 ++++++++++++++++++++++++++++-----------
2 files changed, 41 insertions(+), 20 deletions(-)
Modified: sandbox/SOC/2010/bits_and_ints/libs/integer/test/find_first_one_string_test.cpp
==============================================================================
--- sandbox/SOC/2010/bits_and_ints/libs/integer/test/find_first_one_string_test.cpp (original)
+++ sandbox/SOC/2010/bits_and_ints/libs/integer/test/find_first_one_string_test.cpp 2010-07-28 10:54:11 EDT (Wed, 28 Jul 2010)
@@ -31,12 +31,12 @@
BOOST_TEST((find_first_one_string((uint32_t)0x0000FFFF, 20) == -1));
#ifndef BOOST_HAS_NO_INT64_T
- BOOST_TEST((find_first_one_string((uint64_t)0, 1) == -1));
- BOOST_TEST((find_first_one_string((uint64_t)0, 20) == -1));
- BOOST_TEST((find_first_one_string((uint64_t)0xFFFF0000FFFF, 16) == 16));
- BOOST_TEST((find_first_one_string((uint64_t)0xFFFF0000FF0FFFFF, 17) == 44));
- BOOST_TEST((find_first_one_string((uint64_t)0xFFFFFFFFFFFFFFFF, 64) == 0));
- BOOST_TEST((find_first_one_string((uint64_t)0xFFFFFFFFFFFFFFFF, 63) == 0));
+ BOOST_TEST((find_first_one_string((uint64_t)0ULL, 1) == -1));
+ BOOST_TEST((find_first_one_string((uint64_t)0ULL, 20) == -1));
+ BOOST_TEST((find_first_one_string((uint64_t)0xFFFF0000FFFFULL, 16) == 16));
+ BOOST_TEST((find_first_one_string((uint64_t)0xFFFF0000FF0FFFFFULL, 17) == 44));
+ BOOST_TEST((find_first_one_string((uint64_t)0xFFFFFFFFFFFFFFFFULL, 64) == 0));
+ BOOST_TEST((find_first_one_string((uint64_t)0xFFFFFFFFFFFFFFFFULL, 63) == 0));
#endif
return boost::report_errors();
Modified: sandbox/SOC/2010/bits_and_ints/libs/integer/test/rotate_test.cpp
==============================================================================
--- sandbox/SOC/2010/bits_and_ints/libs/integer/test/rotate_test.cpp (original)
+++ sandbox/SOC/2010/bits_and_ints/libs/integer/test/rotate_test.cpp 2010-07-28 10:54:11 EDT (Wed, 28 Jul 2010)
@@ -14,7 +14,8 @@
BOOST_TEST((::boost::rotate_left(x, n) == y))
#define ROTATE_R_TEST(x, n, y) \
-BOOST_TEST((::boost::rotate_right(x, n) == y))
+BOOST_TEST((::boost::rotate_right(x, n) == y)); \
+std::cout << "aah " << std::hex << ::boost::rotate_right(x, n) << std::endl
int main()
{
@@ -32,21 +33,41 @@
ROTATE_L_TEST(0x00000002, 31, 0x1);
ROTATE_L_TEST(0x12345678, 4, 0x23456781);
+ ROTATE_R_TEST(0x0, 1, 0);
+ ROTATE_R_TEST(0x0, 31, 0);
+ ROTATE_R_TEST(0xFU, 3, 0xE0000001U);
+ ROTATE_R_TEST(0xFU, 1, 0x80000007U);
+ ROTATE_R_TEST(0x8, 3, 0x1);
+ ROTATE_R_TEST(0x9, 3, 0x20000001);
+ ROTATE_R_TEST((int32_t)0xFFFF, 8, (int32_t)0xFF0000FF);
+ ROTATE_R_TEST(0xFFFFFFFF, 1, 0xFFFFFFFF);
+ ROTATE_R_TEST(0xFFFFFFFF, 30, 0xFFFFFFFF);
+ ROTATE_R_TEST(0x12345678, 8, 0x78123456);
+
#ifndef BOOST_HAS_NO_INT64_T
- ROTATE_L_TEST((uint64_t)0x0, 1, 0);
- ROTATE_L_TEST((uint64_t)0x0, 30, 0);
- ROTATE_L_TEST((uint64_t)0xF000000000000000, 4, 0xF);
- ROTATE_L_TEST((uint64_t)0xFF00000000000000, 4, 0xF00000000000000F);
- ROTATE_L_TEST((uint64_t)0xFF00000000000000, 8, 0xFF);
- ROTATE_L_TEST((uint64_t)0xA000000000000000, 1, 0x4000000000000001);
- ROTATE_L_TEST((int64_t)0xA000000000000000, 2, (int64_t)0x8000000000000002);
- ROTATE_L_TEST((int64_t)0xA000000000000000, 3, (int64_t)0x5);
- ROTATE_L_TEST((int64_t)0xC, 8, (int64_t)0xC00);
- ROTATE_L_TEST((int64_t)0xFFFFFFFFFFFFFFFF, 4, (int64_t)0xFFFFFFFFFFFFFFFF);
- ROTATE_L_TEST((int64_t)0xFFFFFFFFFFFFFFFF, 63, (int64_t)0xFFFFFFFFFFFFFFFF);
- ROTATE_L_TEST((int64_t)0x0000000000000002, 63, (int64_t)0x1);
- ROTATE_L_TEST((int64_t)0x123456789ABCDEF0, 4, (int64_t)0x23456789ABCDEF01);
+ ROTATE_L_TEST(0x0ULL, 1, 0ULL);
+ ROTATE_L_TEST(0x0ULL, 30, 0ULL);
+ ROTATE_L_TEST(0xF000000000000000ULL, 4, 0xFULL);
+ ROTATE_L_TEST(0xFF00000000000000ULL, 4, 0xF00000000000000FULL);
+ ROTATE_L_TEST(0xFF00000000000000ULL, 8, 0xFFULL);
+ ROTATE_L_TEST(0xA000000000000000ULL, 1, 0x4000000000000001ULL);
+ ROTATE_L_TEST(0xA000000000000000LL, 2, 0x8000000000000002ULL);
+ ROTATE_L_TEST(0xA000000000000000LL, 3, 0x5LL);
+ ROTATE_L_TEST(0xCLL, 8, 0xC00LL);
+ ROTATE_L_TEST(0xFFFFFFFFFFFFFFFFLL, 4, 0xFFFFFFFFFFFFFFFFLL);
+ ROTATE_L_TEST(0xFFFFFFFFFFFFFFFFLL, 63, 0xFFFFFFFFFFFFFFFFLL);
+ ROTATE_L_TEST(0x0000000000000002LL, 63, 0x1LL);
+ ROTATE_L_TEST(0x123456789ABCDEF0LL, 4, 0x23456789ABCDEF01LL);
+ ROTATE_R_TEST(0x0ULL, 1, 0ULL);
+ ROTATE_R_TEST(0x0ULL, 63, 0ULL);
+ ROTATE_R_TEST(0xFULL, 3, 0xE000000000000001ULL);
+ ROTATE_R_TEST(0xFULL, 1, 0x8000000000000007ULL);
+ ROTATE_R_TEST(0x8ULL, 3, 0x1ULL);
+ ROTATE_R_TEST(0x9LL, 3, 0x2000000000000001LL);
+ ROTATE_R_TEST((int64_t)0xFFFFLL, 8, (int64_t)0xFF000000000000FFLL);
+ ROTATE_R_TEST((uint64_t)0xFFFFFFFFLL, 1, (uint64_t)0x800000007FFFFFFFLL);
+ ROTATE_R_TEST(0xFFFFFFFFFFFFFFFFLL, 30, 0xFFFFFFFFFFFFFFFFLL);
#endif
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