I do not have any code to show at the moment because I am just "thinking about the problem" right now. I want to automatically create testsuites for functions that create random inputs to detect any errors or misbehaviours. But in order to make sure a function is actually pure (not grabbing anything from global namespace or closure-scope) I would like to run it some kind of "sandbox".