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.
36 {
39 map->SetBit(2);
40
42 map->SetValue(
i,
true);
43 }
44 int factor_limit =
static_cast<int>(sqrt(1.0 +
kPrimeLimit));
45 for (int f = 3; f <= factor_limit; f += 2) {
46 if (map->At(f)) {
48 map->ResetBit(f * m);
49 }
50 }
51 }
52 }
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.
92 {
93 int bit_index = -1;
94 int prev_bit_index = -1;
95 int num_bits_tested = 0;
96 while ((bit_index = bv.NextSetBit(bit_index)) >= 0) {
98
99 for (
int i = prev_bit_index + 1;
i < bit_index; ++
i) {
100 EXPECT_EQ(0, bv[
i]) <<
"i = " <<
i <<
" prev = " << prev_bit_index;
101 }
102
103 EXPECT_EQ(1, bv[bit_index]) <<
"Bit index = " << bit_index;
104 ++num_bits_tested;
105 prev_bit_index = bit_index;
106 }
107
108 for (
int i = prev_bit_index + 1;
i < bv.size(); ++
i) {
110 }
111 EXPECT_EQ(num_bits_tested, bv.NumSetBits());
112 }
#define EXPECT_EQ(val1, val2)
#define EXPECT_LT(val1, val2)
◆ OutputNameToPath()
std::string tesseract::BitVectorTest::OutputNameToPath |
( |
const std::string & |
name | ) |
|
|
inline |
Definition at line 32 of file bitvector_test.cc.
32 {
34 }
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.
79 {
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);
85 }
86 }
87 }
88 }
◆ SetUp()
void tesseract::BitVectorTest::SetUp |
( |
| ) |
|
|
inlineoverrideprotectedvirtual |
◆ TestAll()
void tesseract::BitVectorTest::TestAll |
( |
const BitVector & |
map, |
|
|
bool |
value |
|
) |
| |
|
inline |
◆ TestPrimes()
void tesseract::BitVectorTest::TestPrimes |
( |
const BitVector & |
map | ) |
|
|
inline |
Definition at line 54 of file bitvector_test.cc.
54 {
55
56
57
58 int total_primes = 0;
61 ++total_primes;
62 }
63 }
68 }
#define EXPECT_TRUE(condition)
#define EXPECT_FALSE(condition)
The documentation for this class was generated from the following file: