| 163 | } |
| 164 | |
| 165 | void fuzzJsonOperations(BT::Blackboard::Ptr bb) |
| 166 | { |
| 167 | try |
| 168 | { |
| 169 | auto json = BT::ExportBlackboardToJSON(*bb); |
| 170 | if(fuzz_data_.ConsumeBool()) |
| 171 | { |
| 172 | std::string json_str = json.dump(); |
| 173 | size_t pos = fuzz_data_.ConsumeIntegralInRange<size_t>(0, json_str.length()); |
| 174 | json_str.insert(pos, fuzz_data_.ConsumeRandomLengthString()); |
| 175 | json = nlohmann::json::parse(json_str); |
| 176 | } |
| 177 | BT::ImportBlackboardFromJSON(json, *bb); |
| 178 | } |
| 179 | catch(const std::exception& e) |
| 180 | { |
| 181 | if(!ExceptionFilter::isExpectedException(e)) |
| 182 | { |
| 183 | throw; |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | public: |
| 189 | explicit BlackboardFuzzer(FuzzedDataProvider& provider) : fuzz_data_(provider) |
nothing calls this directly
no test coverage detected