Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Data Tests

  • Loading branch information...
commit efebb7b98b3a7b19a216f1e69f4eb2590909fce6 1 parent 0352a9f
@kentfredric kentfredric authored
Showing with 32 additions and 0 deletions.
  1. +32 −0 ELF-Extract-Sections/t/01-elf-libs.t
View
32 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 );
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.