Load information about the tested methods
($filename)
| 416 | |
| 417 | /// Load information about the tested methods |
| 418 | function parseTestFile($filename) { |
| 419 | $tests = array(); |
| 420 | $todo_tests = array(); |
| 421 | $in_test = false; |
| 422 | $last_test = ""; |
| 423 | #load file |
| 424 | $tmp = file($filename); |
| 425 | |
| 426 | foreach($tmp as $line) |
| 427 | { |
| 428 | $line = trim($line); |
| 429 | if(beginsWith($line, "START_SECTION(") || beginsWith($line, "START_SECTION (") || beginsWith($line, "START_SECTION (")) |
| 430 | { |
| 431 | # strip brackets |
| 432 | $function = trim(substr($line, 13)); |
| 433 | //print "Function: $function \n"; |
| 434 | while($function[0] == '(' && $function[strlen($function)-1] == ')') |
| 435 | { |
| 436 | $function = trim(substr($function, 1,-1)); |
| 437 | } |
| 438 | # ignore OPENMS_DLLAPI |
| 439 | $function = str_replace("OPENMS_DLLAPI ", "", $function); |
| 440 | |
| 441 | # ignore extra function tests |
| 442 | if(!beginsWith($function, "[EXTRA]")) |
| 443 | { |
| 444 | $tests[] = $function; |
| 445 | $last_test = $function; |
| 446 | } |
| 447 | $in_test = true; |
| 448 | } |
| 449 | elseif(beginsWith($line, "END_SECTION")) |
| 450 | { |
| 451 | $in_test = false; |
| 452 | } |
| 453 | elseif($in_test) |
| 454 | { |
| 455 | if(strpos($line, "TODO") !== FALSE || strpos($line, "????") !== FALSE) |
| 456 | { |
| 457 | $todo_tests[] = $function; |
| 458 | } |
| 459 | } |
| 460 | } |
| 461 | return array("todo" => $todo_tests, "tests" => $tests); |
| 462 | } |
| 463 | |
| 464 | /// Comares declared and tested methods |
| 465 | function compareDeclarationsAndTests($declarations, $tests) { |
no test coverage detected