2015-04-21 17:29:01 +00:00
|
|
|
package OpenSSL::Test::Simple;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
use Exporter;
|
|
|
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
|
2015-04-30 12:30:15 +00:00
|
|
|
$VERSION = "0.2";
|
2015-04-21 17:29:01 +00:00
|
|
|
@ISA = qw(Exporter);
|
|
|
|
@EXPORT = qw(simple_test);
|
|
|
|
|
2015-04-30 12:30:15 +00:00
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
OpenSSL::Test::Simple - a few very simple test functions
|
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
use OpenSSL::Test::Simple;
|
|
|
|
|
|
|
|
simple_test("my_test_name", "des", "destest");
|
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
|
|
|
Sometimes, the functions in L<OpenSSL::Test> are quite tedious for some
|
|
|
|
repetitive tasks. This module provides functions to make life easier.
|
|
|
|
You could call them hacks if you wish.
|
|
|
|
|
|
|
|
=cut
|
2015-04-21 17:29:01 +00:00
|
|
|
|
|
|
|
use OpenSSL::Test;
|
2015-09-19 22:49:26 +00:00
|
|
|
use OpenSSL::Test::Utils;
|
2015-04-21 17:29:01 +00:00
|
|
|
|
2015-04-30 12:30:15 +00:00
|
|
|
=over 4
|
|
|
|
|
|
|
|
=item B<simple_test NAME, PROGRAM, ALGORITHM>
|
|
|
|
|
|
|
|
Runs a test named NAME, running the program PROGRAM with no arguments,
|
|
|
|
to test the algorithm ALGORITHM.
|
|
|
|
|
|
|
|
A complete recipe looks like this:
|
|
|
|
|
|
|
|
use OpenSSL::Test::Simple;
|
|
|
|
|
|
|
|
simple_test("test_bf", "bftest", "bf");
|
|
|
|
|
|
|
|
=back
|
|
|
|
|
|
|
|
=cut
|
|
|
|
|
2015-04-21 17:29:01 +00:00
|
|
|
# args:
|
|
|
|
# name (used with setup())
|
|
|
|
# algorithm (used to check if it's at all supported)
|
|
|
|
# name of binary (the program that does the actual test)
|
|
|
|
sub simple_test {
|
|
|
|
my ($name, $prgr, $algo, @rest) = @_;
|
|
|
|
|
|
|
|
setup($name);
|
|
|
|
|
2015-09-20 00:15:49 +00:00
|
|
|
plan skip_all => "$algo is not supported by this OpenSSL build"
|
|
|
|
if $algo && disabled($algo);
|
|
|
|
|
2015-04-21 17:29:01 +00:00
|
|
|
plan tests => 1;
|
|
|
|
|
2015-09-20 00:15:49 +00:00
|
|
|
ok(run(test([$prgr])), "running $prgr");
|
2015-04-21 17:29:01 +00:00
|
|
|
}
|
2015-04-30 12:30:15 +00:00
|
|
|
|
|
|
|
=head1 SEE ALSO
|
|
|
|
|
|
|
|
L<OpenSSL::Test>
|
|
|
|
|
|
|
|
=head1 AUTHORS
|
|
|
|
|
|
|
|
Richard Levitte E<lt>levitte@openssl.orgE<gt> with inspiration
|
2015-09-19 22:50:02 +00:00
|
|
|
from Rich Salz E<lt>rsalz@openssl.orgE<gt>.
|
2015-04-30 12:30:15 +00:00
|
|
|
|
|
|
|
=cut
|
|
|
|
|
|
|
|
1;
|