Skip to content

Commit

Permalink
Data Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kentfredric committed May 31, 2009
1 parent 0352a9f commit efebb7b
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions ELF-Extract-Sections/t/01-elf-libs.t
@@ -0,0 +1,32 @@
use strict;
use warnings;

use Test::More tests => 4; # last test to print

use FindBin;
use File::Find::Rule;
use Path::Class qw( file dir );
use YAML::XS;

my $filesdir = "$FindBin::Bin/test_files/";

use ELF::Extract::Sections;

my $exclude = File::Find::Rule->name( "*.pl", "*.yaml" );
my @files = File::Find::Rule->file->not($exclude)->in($filesdir);

for my $file (@files) {
my $f = file($file);
my $yaml = file( $file . '.yaml' );
my $data = YAML::XS::LoadFile( $yaml->stringify );
my $scanner = ELF::Extract::Sections->new( file => $f );
my $d = {};
for ( values %{ $scanner->sections } ){
$d->{$_->name} = {
size => $_->size,
offset => $_->offset,
};
}
is_deeply( $d, $data, "Analysis of ". $f->basename . " matches stored data in " . $yaml->basename );
}

0 comments on commit efebb7b

Please sign in to comment.