aboutsummaryrefslogtreecommitdiffstats
path: root/test/check-probe-using-X
blob: d3ff3160092a9ea2184c71072fac894ff6fdb4cd (plain)
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
#!/usr/bin/perl

use MDK::Common;

foreach my $file (glob("Xorg.*")) {
    my %wanted = cat_($file) =~ /\(=> (\S+): (\S+)\)/g;

    my %got = map {
	(Resolution => /(\S+)/);
    } `../monitor-probe-using-X $file`;

    my @missing = difference2([ keys %wanted ], [ keys %got ]);
    if (@missing) {
	warn "for $file, missing: ", join(' ', @missing), "\n";
    }

    my @surprise = difference2([ keys %got ], [ keys %wanted ]);
    if (@surprise) {
	warn "for $file, surprise: ", join(' ', map { "$_: $got{$_}" } @surprise), "\n";
    }

    my @bad = grep { $wanted{$_} ne $got{$_} } intersection([ keys %wanted ], [ keys %got ]);
    if (@bad) {
	warn "for $file, bad $_: $wanted{$_} != $got{$_}\n" foreach @bad;
    }
}