diff options
author | Guillaume Rousse <guillomovitch@mageia.org> | 2012-08-07 21:12:47 +0000 |
---|---|---|
committer | Guillaume Rousse <guillomovitch@mageia.org> | 2012-08-07 21:12:47 +0000 |
commit | 4f3813c4c94c99e4e061c5655bb4b369181009bb (patch) | |
tree | 5fae891d236ee7a6965ce6cd8a433bcb8929533a /t/find_edid.t | |
parent | 59d616a56cb741be4c0c29090562ce801fcdafdc (diff) | |
download | perl-Parse-EDID-4f3813c4c94c99e4e061c5655bb4b369181009bb.tar perl-Parse-EDID-4f3813c4c94c99e4e061c5655bb4b369181009bb.tar.gz perl-Parse-EDID-4f3813c4c94c99e4e061c5655bb4b369181009bb.tar.bz2 perl-Parse-EDID-4f3813c4c94c99e4e061c5655bb4b369181009bb.tar.xz perl-Parse-EDID-4f3813c4c94c99e4e061c5655bb4b369181009bb.zip |
drop detailed result testing, it fails because string comparaison isn't adequate for floating point numbers
Diffstat (limited to 't/find_edid.t')
-rw-r--r-- | t/find_edid.t | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/t/find_edid.t b/t/find_edid.t new file mode 100644 index 0000000..2e42a75 --- /dev/null +++ b/t/find_edid.t @@ -0,0 +1,44 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use English qw(-no_match_vars); +use Test::More; +use Parse::EDID; + +my %tests = ( + sample1 => [ + '00ffffffffffff0006af14a10000000001120103901a10780a50c59858528e2725505400000001010101010101010101010101010101ea1a007e502010303020360005a31000001aea1a007e502010303020360005a31000001a000000fe00593734374480423132314557300000000000000000000000000001010a202000a5' + ], + sample2 => [ + '00ffffffffffff0006af14a10000000001120103901a10780a50c59858528e2725505400000001010101010101010101010101010101ea1a007e502010303020360005a31000001aea1a007e502010303020360005a31000001a000000fe00593734374480423132314557300000000000000000000000000001010a202000a5', + '00ffffffffffff0022f0f62601010101181401036e362378eece50a3544c99260f5054a56b8081408180a900a940b300d10001010101283c80a070b023403020360022602100001a000000fc004850204c5032343735770a2020000000fd0030551e5e15000a202020202020000000ff00434e43303234303343500a20200085' + ] +); + +plan tests => scalar keys %tests; + +foreach my $test (keys %tests) { + my $string = read_file("t/xrandr/$test"); + + my @edids = find_edid_in_string($string); + is_deeply( + \@edids, + [ map { binary($_) } @{$tests{$test}} ], + "file $test: edids extraction" + ); +} +sub read_file { + my ($file) = @_; + local $RS; + open (my $handle, '<', $file) or die "Can't open $file: $ERRNO"; + my $content = <$handle>; + close $handle; + return $content; +} + +sub binary { + my ($string) = @_; + return pack("C*", map { hex($_) } $string =~ /(..)/g); +} |