Data-SecsPack
view release on metacpan or search on metacpan
t/Data/SecsPack.t view on Meta::CPAN
########
# The working directory for this script file is the directory where
# the test script resides. Thus, any relative files written or read
# by this test script are located relative to this test script.
#
use vars qw( $__restore_dir__ );
$__restore_dir__ = cwd();
my ($vol, $dirs) = File::Spec->splitpath($FindBin::Bin,'nofile');
chdir $vol if $vol;
chdir $dirs if $dirs;
#######
# Pick up any testing program modules off this test script.
#
# When testing on a target site before installation, place any test
# program modules that should not be installed in the same directory
# as this test script. Likewise, when testing on a host with a @INC
# restricted to just raw Perl distribution, place any test program
# modules in the same directory as this test script.
#
use lib $FindBin::Bin;
########
# Using Test::Tech, a very light layer over the module "Test" to
# conduct the tests. The big feature of the "Test::Tech: module
# is that it takes expected and actual references and stringify
# them by using "Data::Secs2" before passing them to the "&Test::ok"
# Thus, almost any time of Perl data structures may be
# compared by passing a reference to them to Test::Tech::ok
#
# Create the test plan by supplying the number of tests
# and the todo tests
#
require Test::Tech;
Test::Tech->import( qw(finish is_skip ok plan skip skip_tests tech_config) );
plan(tests => 21);
}
END {
#########
# Restore working directory and @INC back to when enter script
#
@INC = @lib::ORIG_INC;
chdir $__restore_dir__;
}
=head1 comment_out
###
# Have been problems with debugger with trapping CARP
#
####
# Poor man's eval where the test script traps off the Carp::croak
# Carp::confess functions.
#
# The Perl authorities have Core::die locked down tight so
# it is next to impossible to trap off of Core::die. Lucky
# must everyone uses Carp to die instead of just dieing.
#
use Carp;
use vars qw($restore_croak $croak_die_error $restore_confess $confess_die_error);
$restore_croak = \&Carp::croak;
$croak_die_error = '';
$restore_confess = \&Carp::confess;
$confess_die_error = '';
no warnings;
*Carp::croak = sub {
$croak_die_error = '# Test Script Croak. ' . (join '', @_);
$croak_die_error .= Carp::longmess (join '', @_);
$croak_die_error =~ s/\n/\n#/g;
goto CARP_DIE; # once croak can not continue
};
*Carp::confess = sub {
$confess_die_error = '# Test Script Confess. ' . (join '', @_);
$confess_die_error .= Carp::longmess (join '', @_);
$confess_die_error =~ s/\n/\n#/g;
goto CARP_DIE; # once confess can not continue
};
use warnings;
=cut
# Perl code from C:
use File::Package;
my $fp = 'File::Package';
my $uut = 'Data::SecsPack';
my $loaded;
#####
# Provide a scalar or array context.
#
my ($result,@result);
# Perl code from C:
my $errors = $fp->load_package($uut,
qw(bytes2int float2binary
ifloat2binary int2bytes
pack_float pack_int pack_num
str2float str2int
unpack_float unpack_int unpack_num) );
####
# verifies requirement(s):
# L<DataPort::DataFile/general [1] - load>
#
#####
skip_tests( 1 ) unless skip(
$loaded, # condition to skip test
$errors, # actual results
'', # expected results
"",
"UUT Loaded");
( run in 0.733 second using v1.01-cache-2.11-cpan-39bf76dae61 )