compiler = new EndingsCompiler($mode); $this->mode = $mode; $this->compiler->compile(); $this->epsilon = $this->runTest(); } public function testText($ending) { $this->compiler->compile($ending); return $this->runTest(); } public function runTest() { exec("phpunit compiled/Test.php", $output); preg_match_all('#Tests: ([\d]+), Assertions: ([\d]+), Failures: ([\d]+).#is', $output[count($output)-1], $found); $tests = (float)$found[2][0]; $bad = (float)$found[3][0]; //var_dump($tests); //var_dump(($bad/$tests)); // print_r($found); //echo $bad." ".$tests; return (1-($bad/$tests)); } } $good = array(); $bad = array(); $tester = new BatchTester('endings3'); $epsilon = $tester->epsilon; $endings = file('endings3.txt'); foreach ($endings as $ending) { $persent = $tester->testText(trim($ending)); echo trim($ending)." - ".$persent."\n"; if($persent==$epsilon) { $good[] = $ending; } else { $bad[] = $ending; } } echo "\n\n GOOD"; print_r($good); echo "\n\n BAD"; print_r($bad); ?>