-
-
Notifications
You must be signed in to change notification settings - Fork 596
Expand file tree
/
Copy pathdump-branch-coverage.inc
More file actions
74 lines (66 loc) · 1.57 KB
/
dump-branch-coverage.inc
File metadata and controls
74 lines (66 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
require_once __DIR__ . '/../../contrib/branch-coverage-to-dot.php';
require_once __DIR__ . '/../utils.inc';
function dump_branch_coverage($info)
{
file_put_contents( getTmpFile( "xdebug-paths.dot" ), branch_coverage_to_dot( $info ) );
ksort($info);
foreach ( $info as $fname => $file )
{
if ( preg_match( '/dump-branch-coverage.inc$/', $fname ) )
{
continue;
}
if ( preg_match( '/utils.inc$/', $fname ) )
{
continue;
}
if ( !isset( $file['functions'] ) )
{
continue;
}
ksort( $file['functions'] );
foreach ( $file['functions'] as $fname => $function )
{
if ( $fname == 'branch_coverage_to_dot' )
{
continue;
}
echo $fname, "\n", "- branches\n";
foreach ( $function['branches'] as $bnr => $branch )
{
$str = '';
$str .= sprintf( " - %02d; OP: %02d-%02d; line: %02d-%02d %3s",
$bnr,
$branch['op_start'], $branch['op_end'],
$branch['line_start'], $branch['line_end'],
$branch['hit'] ? "HIT" : " X "
);
foreach ( $branch['out'] as $key => $out )
{
if ( $out == 2147483645 )
{
$str .= sprintf("; out%d: EX %3s", $key + 1,
$branch['out_hit'][$key] ? "HIT" : " X "
);
}
else
{
$str .= sprintf("; out%d: %02d %3s", $key + 1,
$branch['out'][$key],
$branch['out_hit'][$key] ? "HIT" : " X "
);
}
}
echo rtrim( $str ). "\n";
}
echo "- paths\n";
foreach( $function['paths'] as $path )
{
echo ' - ', join( " ", $path['path'] ), ': ';
echo $path['hit'] ? "HIT\n" : " X\n";
}
echo "\n";
}
}
}