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

Function TEST_F

bolt/expression/fuzzer/tests/ExpressionFuzzerUnitTest.cpp:85–119  ·  view source on GitHub ↗

namespace

Source from the content-addressed store, hash-verified

83}
84} // namespace
85TEST_F(ExpressionFuzzerUnitTest, restrictedLevelOfNesting) {
86 bolt::functions::prestosql::registerAllScalarFunctions();
87 std::mt19937 seed{0};
88
89 auto testLevelOfNesting = [&](int32_t maxLevelOfNesting) {
90 ExpressionFuzzer fuzzer{
91 bolt::getFunctionSignatures(),
92 0,
93 vectorfuzzer,
94 makeOptionsWithMaxLevelNesting(maxLevelOfNesting),
95 };
96
97 for (int i = 0; i < 5000; ++i) {
98 auto expression = fuzzer.fuzzExpression().expressions[0];
99 EXPECT_LE(countLevelOfNesting(expression), std::max(1, maxLevelOfNesting))
100 << fmt::format(
101 "Expression {} exceeds max level of nesting {} (original {})",
102 expression->toString(),
103 std::max(1, maxLevelOfNesting),
104 maxLevelOfNesting);
105 }
106 };
107
108 testLevelOfNesting(10);
109
110 testLevelOfNesting(5);
111
112 testLevelOfNesting(2);
113
114 testLevelOfNesting(1);
115
116 testLevelOfNesting(0);
117
118 testLevelOfNesting(-1);
119}
120
121TEST_F(ExpressionFuzzerUnitTest, reproduceExpressionWithSeed) {
122 bolt::functions::prestosql::registerAllScalarFunctions();

Callers

nothing calls this directly

Calls 12

getFunctionSignaturesFunction · 0.85
fuzzExpressionMethod · 0.80
getRandomExpressionMethod · 0.80
maxFunction · 0.50
toStringMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45
typeMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected