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

Function randOrderableType

bolt/vector/fuzzer/VectorFuzzer.cpp:1685–1704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1683}
1684
1685TypePtr randOrderableType(FuzzerGenerator& rng, int maxDepth) {
1686 // Should we generate a scalar type?
1687 if (maxDepth <= 1 || rand<bool>(rng)) {
1688 return randType(rng, 0);
1689 }
1690
1691 // ARRAY or ROW?
1692 if (rand<bool>(rng)) {
1693 return ARRAY(randOrderableType(rng, maxDepth - 1));
1694 }
1695
1696 auto numFields = 1 + rand<uint32_t>(rng) % 7;
1697 std::vector<std::string> names;
1698 std::vector<TypePtr> fields;
1699 for (int i = 0; i < numFields; ++i) {
1700 names.push_back(fmt::format("f{}", i));
1701 fields.push_back(randOrderableType(rng, maxDepth - 1));
1702 }
1703 return ROW(std::move(names), std::move(fields));
1704}
1705
1706TypePtr randType(
1707 FuzzerGenerator& rng,

Callers 3

randOrderableTypeMethod · 0.85
randOrderableTypeMethod · 0.85

Calls 4

randTypeFunction · 0.85
ARRAYFunction · 0.85
ROWFunction · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected