def validate(self, benchmarks):
class_code = self.setup_src<EOL>instance_creation = '<STR_LIT>'.format(self.stmt)<EOL>for i, benchmark in enumerate(benchmarks):<EOL><INDENT>if not benchmark.result_validation:<EOL><INDENT>break<EOL><DEDENT>validation_code = class_code + instance_creation + '<STR_LIT>' + benchmark.stmt<EOL>validation_scope = {}<EOL>exec(validation_code, validation_scope)<EOL>if i == <NUM_LIT:0>:<EOL><INDENT>compare_against_function = benchmarks[<NUM_LIT:0>].callable.__name__<EOL>compare_against_result = validation_scope['<STR_LIT>']<EOL>logging.info('<STR_LIT>'<EOL>'<STR_LIT>'.format(b=benchmarks[<NUM_LIT:0>]))<EOL><DEDENT>else:<EOL><INDENT>if compare_against_result == validation_scope['<STR_LIT>']:<EOL><INDENT>logging.info('<STR_LIT>'<EOL>.format(b=benchmark))<EOL><DEDENT>else:<EOL><INDENT>error = '<STR_LIT>'<EOL>raise ValidationError(error.format(compare_against_function, benchmark.callable.__name__,<EOL>compare_against_result, validation_scope['<STR_LIT>']))<EOL><DEDENT><DEDENT><DEDENT>
Execute the code once to get it's results (to be used in function validation). Compare the result to the
first function in the group.
:param benchmarks: list of benchmarks to validate.