#!/usr/bin/perl use strict; use warnings; use English qw(-no_match_vars); use Test::More; use Parse::EDID; my %tests = ( 'crt.13' => { 'manufacturer_name' => 'LTN', 'monitor_name' => 'A1554NEL', 'EISA_ID' => 'LTNa543' }, 'crt.dell-d1626ht' => { 'manufacturer_name' => 'DEL', 'monitor_name' => 'DELL D1626HT', 'EISA_ID' => 'DEL515b', }, 'crt.dell-p1110' => { 'manufacturer_name' => 'DEL', 'monitor_name' => 'DELL P1110', 'EISA_ID' => 'DEL50ab' }, 'crt.dell-p790' => { 'manufacturer_name' => 'DEL', 'monitor_name' => 'DELL P790', 'EISA_ID' => 'DEL62f5' }, 'crt.E55' => { 'manufacturer_name' => 'MEI', 'monitor_name' => undef, 'EISA_ID' => 'MEI264a' }, 'crt.emc0313' => { 'manufacturer_name' => 'EMC', 'monitor_name' => undef, 'EISA_ID' => 'EMC0313' }, 'crt.hyundai-ImageQuest-L70S+' => { 'manufacturer_name' => 'IQT', 'monitor_name' => 'L70S+', 'EISA_ID' => 'IQT0704' }, 'crt.iiyama-1451' => { 'manufacturer_name' => 'IVM', 'monitor_name' => 'LS902U', 'EISA_ID' => 'IVM1938' }, 'crt.iiyama-404' => { 'manufacturer_name' => 'IVM', 'monitor_name' => undef, 'EISA_ID' => 'IVM1744' }, 'crt.iiyama-410pro' => { 'manufacturer_name' => 'IVM', 'monitor_name' => undef, 'EISA_ID' => 'IVM1740' }, 'crt.leia' => { 'manufacturer_name' => 'CPQ', 'monitor_name' => 'COMPAQ P710', 'EISA_ID' => 'CPQ1384' }, 'crt.LG-Studioworks-N2200P' => { 'manufacturer_name' => 'GSM', 'monitor_name' => 'Studioworks N 2200P', 'EISA_ID' => 'GSM55f3', }, 'crt.med2914' => { 'manufacturer_name' => 'MED', 'monitor_name' => undef, 'EISA_ID' => 'MED2914' }, 'crt.nokia-valuegraph-447w' => { 'manufacturer_name' => 'NOK', 'monitor_name' => undef, 'EISA_ID' => 'NOK00b7' }, 'crt.SM550S' => { 'manufacturer_name' => 'SAM', 'monitor_name' => undef, 'EISA_ID' => 'SAM1035' }, 'crt.SM550V' => { 'manufacturer_name' => 'SAM', 'monitor_name' => 'S/M 550v', 'EISA_ID' => 'SAM12b6' }, 'crt.sony-gdm400ps' => { 'manufacturer_name' => 'SNY', 'monitor_name' => 'GDM-400PST9', 'EISA_ID' => 'SNY0090' }, 'crt.sony-gdm420' => { 'manufacturer_name' => 'SNY', 'monitor_name' => 'CPD-G420', 'EISA_ID' => 'SNY0490' }, 'crt.test_box_lmontel' => { 'manufacturer_name' => 'CPQ', 'monitor_name' => 'COMPAQ MV920', 'EISA_ID' => 'CPQ3027' }, 'lcd.20inches' => { 'manufacturer_name' => 'MAX', 'monitor_name' => 'B102005', 'EISA_ID' => 'MAX07d3' }, 'lcd.acer-al1921' => { 'manufacturer_name' => 'ACR', 'monitor_name' => 'Acer AL1921', 'EISA_ID' => 'ACRad25' }, 'lcd.acer-asp1680' => { 'manufacturer_name' => 'QDS', 'monitor_name' => undef, 'EISA_ID' => 'QDS0014' }, 'lcd.b-101750' => { 'manufacturer_name' => 'MAX', 'monitor_name' => 'B_101750', 'EISA_ID' => 'MAX06ac' }, 'lcd.benq-t904' => { 'manufacturer_name' => 'BNQ', 'monitor_name' => 'BenQ T904', 'EISA_ID' => 'BNQ7681' }, 'lcd.blino' => { 'manufacturer_name' => 'AUO', 'monitor_name' => undef, 'EISA_ID' => 'AUO0f03' }, 'lcd.cmc-17-AD' => { 'manufacturer_name' => 'CMO', 'monitor_name' => 'CMC 17" AD', 'EISA_ID' => 'CMO7801' }, 'lcd.compaq-evo-n1020v' => { 'manufacturer_name' => 'LGP', 'monitor_name' => undef, 'EISA_ID' => 'LGP6e54' }, 'lcd.dell-2001fp' => { 'manufacturer_name' => 'DEL', 'monitor_name' => 'DELL 2001FP', 'EISA_ID' => 'DELa007' }, 'lcd.dell-inspiron-6400' => { 'manufacturer_name' => 'LPL', 'monitor_name' => undef, 'EISA_ID' => undef }, 'lcd.Elonex-PR600' => { 'manufacturer_name' => 'CMO', 'monitor_name' => undef, 'EISA_ID' => 'CMO1526', }, 'lcd.gericom-cy-96' => { 'manufacturer_name' => 'PTS', 'monitor_name' => 'CY965', 'EISA_ID' => 'PTS03c5' }, 'lcd.hp-nx-7000' => { 'manufacturer_name' => 'LGP', 'monitor_name' => undef, 'EISA_ID' => undef }, 'lcd.hp-nx-7010' => { 'manufacturer_name' => 'LGP', 'monitor_name' => undef, 'EISA_ID' => undef }, 'lcd.HP-Pavilion-ZV6000' => { 'manufacturer_name' => 'QDS', 'monitor_name' => undef, 'EISA_ID' => 'QDS0014' }, 'lcd.lenovo-3000-v100' => { 'manufacturer_name' => 'AUO', 'monitor_name' => undef, 'EISA_ID' => 'AUO3214' }, 'lcd.lenovo-w500' => { 'manufacturer_name' => 'LEN', 'monitor_name' => undef, 'EISA_ID' => 'LEN4055' }, 'lcd.philips-150s' => { 'manufacturer_name' => 'PHL', 'monitor_name' => 'PHILIPS 150S', 'EISA_ID' => 'PHL0805' }, 'lcd.philips-180b2' => { 'manufacturer_name' => 'PHL', 'monitor_name' => 'Philips 180B2', 'EISA_ID' => 'PHL0810' }, 'lcd.presario-R4000' => { 'manufacturer_name' => 'LPL', 'monitor_name' => undef, 'EISA_ID' => undef, }, 'lcd.rafael' => { 'manufacturer_name' => 'MAX', 'monitor_name' => 'B101715', 'EISA_ID' => 'MAX06b5' }, 'lcd.regis' => { 'manufacturer_name' => 'ENC', 'monitor_name' => 'L557', 'EISA_ID' => 'ENC1689' }, 'lcd.samsung-191n' => { 'manufacturer_name' => 'SAM', 'monitor_name' => 'SyncMaster', 'EISA_ID' => 'SAM0080' }, 'lcd.tv.VQ32-1T' => { 'manufacturer_name' => 'FUS', 'monitor_name' => 'VQ32-1T', 'EISA_ID' => 'FUS065b' }, ); plan tests => 2 * scalar keys %tests; foreach my $test (sort keys %tests) { my $edid = read_file("t/edid/$test"); my $parsed_edid = parse_edid($edid); my $message = check_parsed_edid($parsed_edid); is($message, "", "$test: parsing succesful"); subtest "$test: expected results" => sub { check_result($parsed_edid, $tests{$test}); }; } 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 check_result { my ($got, $expected) = @_; foreach my $field (qw/manufacturer_name monitor_name EISA_ID/) { is($got->{$field}, $expected->{$field}, $field); } }