MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / parseTestFile

Function parseTestFile

tools/common_functions.php:418–462  ·  view source on GitHub ↗

Load information about the tested methods

($filename)

Source from the content-addressed store, hash-verified

416
417/// Load information about the tested methods
418function 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
465function compareDeclarationsAndTests($declarations, $tests) {

Callers 2

correct_test.phpFile · 0.85
checker.phpFile · 0.85

Calls 2

beginsWithFunction · 0.85
substrFunction · 0.50

Tested by

no test coverage detected