Comares declared and tested methods
($declarations, $tests)
| 463 | |
| 464 | /// Comares declared and tested methods |
| 465 | function compareDeclarationsAndTests($declarations, $tests) { |
| 466 | # Replacements to use when comparing methods |
| 467 | $method_replacements = array( |
| 468 | "std::" => "", |
| 469 | "OpenMS::" => "", |
| 470 | " " => "", |
| 471 | "\t" => "", |
| 472 | "=0" => "", |
| 473 | "throw()" => "", |
| 474 | "virtual" => "", |
| 475 | "static" => "", |
| 476 | "/*" => "", |
| 477 | "*/" => "", |
| 478 | ); |
| 479 | |
| 480 | $done = array(); |
| 481 | |
| 482 | $out = array( |
| 483 | "missing" => array(), |
| 484 | "unknown" => array(), |
| 485 | "double" => array(), |
| 486 | ); |
| 487 | |
| 488 | #make a copy without whitespaces |
| 489 | $tmp = array(); |
| 490 | foreach($declarations as $m) |
| 491 | { |
| 492 | $tmp[] = strtr($m, $method_replacements); |
| 493 | } |
| 494 | |
| 495 | #compare tests and declarations |
| 496 | foreach($tests as $t) |
| 497 | { |
| 498 | $stripped = strtr($t, $method_replacements); |
| 499 | $pos = array_search($stripped, $tmp); |
| 500 | if($pos === FALSE) |
| 501 | { |
| 502 | if(in_array($stripped, $done)) |
| 503 | { |
| 504 | $out["double"][] = $t; |
| 505 | } |
| 506 | else |
| 507 | { |
| 508 | $out["unknown"][] = $t; |
| 509 | } |
| 510 | } |
| 511 | else |
| 512 | { |
| 513 | unset($tmp[$pos]); |
| 514 | $done[] = $stripped; |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | #report extra tests |
| 519 | if(count($tmp) != 0) |
| 520 | { |
| 521 | foreach($tmp as $t) |
| 522 | { |