MCPcopy Create free account
hub / github.com/bytedance/bolt / setValid_normal

Function setValid_normal

bolt/vector/tests/SelectivityVectorTest.cpp:89–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89void setValid_normal(bool setToValue) {
90 // A little bit more than 2 simd widths, so overflow.
91 const size_t vectorSize = 513;
92
93 // We'll set everything to the opposite of the setToValue
94 std::vector<bool> expected(vectorSize, !setToValue);
95 SelectivityVector vector(vectorSize);
96 if (setToValue) {
97 vector.clearAll();
98 }
99
100 auto setAndAssert = [&](size_t index, bool value) {
101 vector.setValid(index, value);
102 expected[index] = value;
103 ASSERT_NO_FATAL_FAILURE(
104 assertState(expected, vector, false /*testProperties*/))
105 << "Setting to " << value << " at " << index;
106 };
107
108 for (size_t i = 0; i < expected.size(); ++i) {
109 ASSERT_NO_FATAL_FAILURE(setAndAssert(i, setToValue));
110 ASSERT_NO_FATAL_FAILURE(setAndAssert(i, !setToValue));
111 }
112}
113
114}; // namespace
115

Callers 1

TESTFunction · 0.85

Calls 4

assertStateFunction · 0.85
setValidMethod · 0.80
clearAllMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected