MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / LLVMFuzzerTestOneInput

Function LLVMFuzzerTestOneInput

src/libfuzzer_client.cpp:269–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
270 chaiscript::ChaiScript chai;
271
272 chai.eval( R"chaiscript(
273def assert_equal(x, y)
274{
275 if (x == y)
276 {
277 // Passes
278 } else {
279 // Fails
280 print("assert_equal failure: got '" + to_string(y) + "' expected '" + to_string(x) + "'");
281// exit(-1);
282 }
283}
284
285def assert_false(f)
286{
287 if (f)
288 {
289 print("assert_false failure");
290// exit(-1);
291 }
292}
293
294def assert_true(f)
295{
296 if (!f)
297 {
298 print("assert_true failure");
299// exit(-1);
300 }
301}
302
303def assert_not_equal(x, y)
304{
305 if (!(x == y))
306 {
307 // Passes
308 } else {
309 // Fails
310 print("assert_not_equal failure: got " + to_string(y) + " which was not expected.");
311// exit(-1);
312 }
313}
314
315def assert_throws(desc, x)
316{
317 if (throws_exception(x))
318 {
319 // Passes
320 } else {
321 // Fails
322 print("assert_throws failure, function did not throw exception: " + to_string(desc));
323// exit(-1);
324 }
325})chaiscript");
326

Callers

nothing calls this directly

Calls 3

stringClass · 0.85
evalMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected