For some reason the first thing that popped into my head when I read this was fuzzers like American Fuzzy Lopp. I wonder if you could use the same sort of stochastic exploration to explore the space of possible programs satisfying a set of tests rather than explore the space of possible inputs given a program?