dimanche 3 mai 2020

How can I test and validate random unknown code

I am working on a project that requires testing and validating javascript snippets. It's supposed to be very general purpose and abstract. Say you have some unknown function read from some random js file:

function sum(A,B) { ... }

We consider the function valid if it returns some value (other than empty '', [ ], { }, null or undefined). But we don't know the argument types (they could be numbers or arrays, or ...). The body of the function could be simple arithmetic or a complex algorithm. Is there a clever way to test some random function without brute forcing?

Aucun commentaire:

Enregistrer un commentaire