|
11 | 11 |
|
12 | 12 | #include <arcticdb/pipeline/test/test_container.hpp>
|
13 | 13 |
|
14 |
| -TEST(BitsetForIndex, DynamicSchemaStrictlyBefore) { |
| 14 | +struct BitsetForIndex : public testing::TestWithParam<bool> { |
| 15 | + bool is_read_operation() const { return GetParam(); } |
| 16 | +}; |
| 17 | + |
| 18 | +TEST_P(BitsetForIndex, DynamicSchemaStrictlyBefore) { |
15 | 19 | using namespace arcticdb;
|
16 | 20 | using namespace arcticdb::pipelines;
|
17 | 21 | TestContainer container;
|
18 | 22 | container.seg().set_range(3, 4);
|
19 | 23 | container.seg().set_range(5, 7);
|
20 | 24 | IndexRange rg(NumericIndex{0}, NumericIndex{2});
|
21 | 25 | auto bitset = build_bitset_for_index<TestContainer, TimeseriesIndex>(
|
22 |
| - container, rg, true, false, std::unique_ptr<util::BitSet>{} |
| 26 | + container, rg, true, false, is_read_operation(), std::unique_ptr<util::BitSet>{} |
23 | 27 | );
|
24 | 28 | ASSERT_EQ(bitset->count(), 0);
|
25 | 29 | }
|
26 | 30 |
|
27 |
| -TEST(BitsetForIndex, DynamicSchemaStrictlyAfter) { |
| 31 | +TEST_P(BitsetForIndex, DynamicSchemaStrictlyAfter) { |
28 | 32 | using namespace arcticdb;
|
29 | 33 | using namespace arcticdb::pipelines;
|
30 | 34 | TestContainer container;
|
31 | 35 | container.seg().set_range(0, 2);
|
32 | 36 | container.seg().set_range(3, 4);
|
33 | 37 | IndexRange rg(NumericIndex{5}, NumericIndex{7});
|
34 | 38 | auto bitset = build_bitset_for_index<TestContainer, TimeseriesIndex>(
|
35 |
| - container, rg, true, false, std::unique_ptr<util::BitSet>{} |
| 39 | + container, rg, true, false, is_read_operation(), std::unique_ptr<util::BitSet>{} |
36 | 40 | );
|
37 | 41 | ASSERT_EQ(bitset->count(), 0);
|
38 | 42 | }
|
39 | 43 |
|
40 |
| -TEST(BitsetForIndex, DynamicSchemaMiddle) { |
| 44 | +TEST_P(BitsetForIndex, DynamicSchemaMiddle) { |
41 | 45 | using namespace arcticdb;
|
42 | 46 | using namespace arcticdb::pipelines;
|
43 | 47 | TestContainer container;
|
44 | 48 | container.seg().set_range(0, 2);
|
45 | 49 | container.seg().set_range(5, 7);
|
46 | 50 | IndexRange rg(NumericIndex{3}, NumericIndex{4});
|
47 | 51 | auto bitset = build_bitset_for_index<TestContainer, TimeseriesIndex>(
|
48 |
| - container, rg, true, false, std::unique_ptr<util::BitSet>{} |
| 52 | + container, rg, true, false, is_read_operation(), std::unique_ptr<util::BitSet>{} |
49 | 53 | );
|
50 | 54 | ASSERT_EQ(bitset->count(), 0);
|
51 | 55 | }
|
52 | 56 |
|
53 |
| -TEST(BitsetForIndex, DynamicSchemaOverlapBegin) { |
| 57 | +TEST_P(BitsetForIndex, DynamicSchemaOverlapBegin) { |
54 | 58 | using namespace arcticdb;
|
55 | 59 | using namespace arcticdb::pipelines;
|
56 | 60 | TestContainer container;
|
57 | 61 | container.seg().set_range(2, 4);
|
58 | 62 | container.seg().set_range(5, 7);
|
59 | 63 | IndexRange rg(NumericIndex{1}, NumericIndex{3});
|
60 | 64 | auto bitset = build_bitset_for_index<TestContainer, TimeseriesIndex>(
|
61 |
| - container, rg, true, false, std::unique_ptr<util::BitSet>{} |
| 65 | + container, rg, true, false, is_read_operation(), std::unique_ptr<util::BitSet>{} |
62 | 66 | );
|
63 | 67 | ASSERT_EQ((*bitset)[0], true);
|
64 | 68 | ASSERT_EQ(bitset->count(), 1);
|
65 | 69 | }
|
66 | 70 |
|
67 |
| -TEST(BitsetForIndex, DynamicSchemaOverlapEnd) { |
| 71 | +TEST_P(BitsetForIndex, DynamicSchemaOverlapEnd) { |
68 | 72 | using namespace arcticdb;
|
69 | 73 | using namespace arcticdb::pipelines;
|
70 | 74 | TestContainer container;
|
71 | 75 | container.seg().set_range(2, 4);
|
72 | 76 | container.seg().set_range(5, 7);
|
73 | 77 | IndexRange rg(NumericIndex{6}, NumericIndex{8});
|
74 | 78 | auto bitset = build_bitset_for_index<TestContainer, TimeseriesIndex>(
|
75 |
| - container, rg, true, false, std::unique_ptr<util::BitSet>{} |
| 79 | + container, rg, true, false, is_read_operation(), std::unique_ptr<util::BitSet>{} |
76 | 80 | );
|
77 | 81 | ASSERT_EQ((*bitset)[1], true);
|
78 | 82 | ASSERT_EQ(bitset->count(), 1);
|
79 | 83 | }
|
| 84 | + |
| 85 | +TEST_P(BitsetForIndex, DynamicSchemaMatchEndIndex) { |
| 86 | + using namespace arcticdb; |
| 87 | + using namespace arcticdb::pipelines; |
| 88 | + TestContainer container; |
| 89 | + container.seg().set_range(2, 4); |
| 90 | + container.seg().set_range(5, 7); |
| 91 | + IndexRange rg(NumericIndex{7}, NumericIndex{7}); |
| 92 | + auto bitset = build_bitset_for_index<TestContainer, TimeseriesIndex>( |
| 93 | + container, rg, true, false, is_read_operation(), std::unique_ptr<util::BitSet>{} |
| 94 | + ); |
| 95 | + ASSERT_EQ((*bitset)[1], is_read_operation()); |
| 96 | + ASSERT_EQ(bitset->count(), is_read_operation() ? 1 : 0); |
| 97 | +} |
| 98 | + |
| 99 | +INSTANTIATE_TEST_SUITE_P(BitsetForIndexTests, BitsetForIndex, testing::Values(true, false)); |
0 commit comments