Definition at line 24 of file bitvector_test.cc.
◆ ComputePrimes()
void tesseract::BitVectorTest::ComputePrimes |
( |
BitVector * |
map | ) |
|
|
inline |
Definition at line 36 of file bitvector_test.cc.
42 map->SetValue(i,
true);
44 int factor_limit =
static_cast<int>(sqrt(1.0 +
kPrimeLimit));
45 for (
int f = 3; f <= factor_limit; f += 2) {
void TestAll(const BitVector &map, bool value)
◆ ExpectCorrectBits()
void tesseract::BitVectorTest::ExpectCorrectBits |
( |
const BitVector & |
bv | ) |
|
|
inline |
Definition at line 92 of file bitvector_test.cc.
94 int prev_bit_index = -1;
95 int num_bits_tested = 0;
96 while ((bit_index = bv.NextSetBit(bit_index)) >= 0) {
97 EXPECT_LT(bit_index, bv.size());
99 for (
int i = prev_bit_index + 1; i < bit_index; ++i) {
100 EXPECT_EQ(0, bv[i]) <<
"i = " << i <<
" prev = " << prev_bit_index;
103 EXPECT_EQ(1, bv[bit_index]) <<
"Bit index = " << bit_index;
105 prev_bit_index = bit_index;
108 for (
int i = prev_bit_index + 1; i < bv.size(); ++i) {
111 EXPECT_EQ(num_bits_tested, bv.NumSetBits());
◆ OutputNameToPath()
std::string tesseract::BitVectorTest::OutputNameToPath |
( |
const std::string & |
name | ) |
|
|
inline |
Definition at line 32 of file bitvector_test.cc.
static std::string JoinPath(const std::string &s1, const std::string &s2)
◆ SetBitPattern()
void tesseract::BitVectorTest::SetBitPattern |
( |
int |
start_byte, |
|
|
int |
end_byte, |
|
|
int |
spacing, |
|
|
BitVector * |
bv |
|
) |
| |
|
inline |
Definition at line 79 of file bitvector_test.cc.
80 bv->Init((end_byte - start_byte) * 8 * spacing);
81 for (
int byte_value = start_byte; byte_value < end_byte; ++byte_value) {
82 for (
int bit = 0; bit < 8; ++bit) {
83 if (byte_value & (1 << bit)) {
84 bv->SetBit((byte_value - start_byte) * 8 * spacing + bit);
◆ SetUp()
void tesseract::BitVectorTest::SetUp |
( |
| ) |
|
|
inlineoverrideprotected |
◆ TestAll()
void tesseract::BitVectorTest::TestAll |
( |
const BitVector & |
map, |
|
|
bool |
value |
|
) |
| |
|
inline |
Definition at line 70 of file bitvector_test.cc.
71 for (
int i = 0; i < map.size(); ++i) {
72 EXPECT_EQ(value, map[i]);
◆ TestPrimes()
void tesseract::BitVectorTest::TestPrimes |
( |
const BitVector & |
map | ) |
|
|
inline |
Definition at line 54 of file bitvector_test.cc.
64 EXPECT_EQ(168, total_primes);
65 EXPECT_TRUE(map[997]);
66 EXPECT_FALSE(map[998]);
67 EXPECT_FALSE(map[999]);
The documentation for this class was generated from the following file: