32 const int kRangeSize = 8;
33 TestableQRSequenceGenerator generator(kRangeSize);
34 int reversed_vals[kRangeSize] = {0, 4, 2, 6, 1, 5, 3, 7};
35 for (
int i = 0; i < kRangeSize; ++i)
36 EXPECT_EQ(reversed_vals[i], generator.GetBinaryReversedInteger(i));
40 class QRSequenceGeneratorTest :
public ::testing::TestWithParam<int> {
43 std::locale::global(std::locale(
""));
47 TEST_P(QRSequenceGeneratorTest, GeneratesValidSequence) {
48 const int kRangeSize = GetParam();
49 TestableQRSequenceGenerator generator(kRangeSize);
50 std::vector<int> vals(kRangeSize);
53 for (
int i = 0; i < kRangeSize; ++i) vals[i] = generator.GetVal();
54 LOG(
INFO) << kRangeSize <<
"-length sequence took " << timer.
GetInMs() <<
"ms";
56 std::sort(vals.begin(), vals.end());
57 for (
int i = 0; i < kRangeSize; ++i) {
58 EXPECT_EQ(i, vals[i]);
60 LOG(
INFO) <<
"Aborting remaining comparisons";
67 INSTANTIATE_TEST_CASE_P(RangeTest, QRSequenceGeneratorTest,
68 ::testing::Values(2, 7, 8, 9, 16, 1e2, 1e4, 1e6));