mirror of
https://github.com/boostorg/dynamic_bitset.git
synced 2026-01-19 04:12:09 +00:00
Added copyright statement and untabified
[SVN r17191]
This commit is contained in:
@@ -66,7 +66,7 @@ struct bitset_test {
|
||||
if (! (str[i] == '0' || str[i] == '1'))
|
||||
any_non_zero_or_one = true;
|
||||
if (any_non_zero_or_one) {
|
||||
// Input does not satisfy precondition.
|
||||
// Input does not satisfy precondition.
|
||||
} else {
|
||||
// Construct an object, initializing the first M bit position to
|
||||
// values determined from the corresponding characters in the
|
||||
@@ -97,10 +97,10 @@ struct bitset_test {
|
||||
Bitset bset(blocks.begin(), blocks.end());
|
||||
std::size_t n = blocks.size();
|
||||
for (std::size_t b = 0; b < n; ++b) {
|
||||
for (std::size_t i = 0; i < sizeof(Block) * CHAR_BIT; ++i) {
|
||||
std::size_t bit = b * sizeof(Block) * CHAR_BIT + i;
|
||||
BOOST_CHECK(bset[bit] == nth_bit(blocks[b], i));
|
||||
}
|
||||
for (std::size_t i = 0; i < sizeof(Block) * CHAR_BIT; ++i) {
|
||||
std::size_t bit = b * sizeof(Block) * CHAR_BIT + i;
|
||||
BOOST_CHECK(bset[bit] == nth_bit(blocks[b], i));
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
@@ -108,10 +108,10 @@ struct bitset_test {
|
||||
boost::from_block_range(blocks.begin(), blocks.end(), bset);
|
||||
std::size_t n = blocks.size();
|
||||
for (std::size_t b = 0; b < n; ++b) {
|
||||
for (std::size_t i = 0; i < sizeof(Block) * CHAR_BIT; ++i) {
|
||||
std::size_t bit = b * sizeof(Block) * CHAR_BIT + i;
|
||||
BOOST_CHECK(bset[bit] == nth_bit(blocks[b], i));
|
||||
}
|
||||
for (std::size_t i = 0; i < sizeof(Block) * CHAR_BIT; ++i) {
|
||||
std::size_t bit = b * sizeof(Block) * CHAR_BIT + i;
|
||||
BOOST_CHECK(bset[bit] == nth_bit(blocks[b], i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -531,15 +531,15 @@ struct bitset_test {
|
||||
{
|
||||
if (a.is_subset_of(b)) {
|
||||
for (std::size_t I = 0; I < a.size(); ++I)
|
||||
if (a[I])
|
||||
BOOST_CHECK(b[I]);
|
||||
if (a[I])
|
||||
BOOST_CHECK(b[I]);
|
||||
} else {
|
||||
bool is_subset = true;
|
||||
for (std::size_t I = 0; I < a.size(); ++I)
|
||||
if (a[I] && !b[I]) {
|
||||
is_subset = false;
|
||||
break;
|
||||
}
|
||||
if (a[I] && !b[I]) {
|
||||
is_subset = false;
|
||||
break;
|
||||
}
|
||||
BOOST_CHECK(is_subset == false);
|
||||
}
|
||||
}
|
||||
@@ -548,16 +548,16 @@ struct bitset_test {
|
||||
{
|
||||
if (a.is_proper_subset_of(b)) {
|
||||
for (std::size_t I = 0; I < a.size(); ++I)
|
||||
if (a[I])
|
||||
BOOST_CHECK(b[I]);
|
||||
if (a[I])
|
||||
BOOST_CHECK(b[I]);
|
||||
BOOST_CHECK(a.count() < b.count());
|
||||
} else {
|
||||
bool is_subset = true;
|
||||
for (std::size_t I = 0; I < a.size(); ++I)
|
||||
if (a[I] && !b[I]) {
|
||||
is_subset = false;
|
||||
break;
|
||||
}
|
||||
if (a[I] && !b[I]) {
|
||||
is_subset = false;
|
||||
break;
|
||||
}
|
||||
BOOST_CHECK(is_subset == false || a.count() >= b.count());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
// (C) Copyright Jeremy Siek 2001.
|
||||
// Permission to copy, use, modify, sell and distribute this software
|
||||
// is granted provided this copyright notice appears in all
|
||||
// copies. This software is provided "as is" without express or
|
||||
// implied warranty, and with no claim as to its suitability for any
|
||||
// purpose.
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cmath> // for pow
|
||||
@@ -29,7 +36,7 @@ void run_test_cases()
|
||||
std::size_t N, ul_size = CHAR_BIT * sizeof(unsigned long),
|
||||
block_size = CHAR_BIT * sizeof(Block);
|
||||
unsigned long numbers[] = { 0, 40247,
|
||||
std::numeric_limits<unsigned long>::max() };
|
||||
std::numeric_limits<unsigned long>::max() };
|
||||
|
||||
//=====================================================================
|
||||
// Test construction from unsigned long
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
// (C) Copyright Jeremy Siek 2001.
|
||||
// Permission to copy, use, modify, sell and distribute this software
|
||||
// is granted provided this copyright notice appears in all
|
||||
// copies. This software is provided "as is" without express or
|
||||
// implied warranty, and with no claim as to its suitability for any
|
||||
// purpose.
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cmath> // for pow
|
||||
@@ -230,3 +237,4 @@ test_main(int argc, char*[])
|
||||
run_test_cases<unsigned long>();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
// (C) Copyright Jeremy Siek 2001.
|
||||
// Permission to copy, use, modify, sell and distribute this software
|
||||
// is granted provided this copyright notice appears in all
|
||||
// copies. This software is provided "as is" without express or
|
||||
// implied warranty, and with no claim as to its suitability for any
|
||||
// purpose.
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cmath> // for pow
|
||||
|
||||
Reference in New Issue
Block a user