1#!/usr/bin/env perl
2use strict;
3use warnings;
4
5## 00-errorhandler.t -- Test for the base class and error handling
6##                      methods therein.
7##
8## Copyright (c) 2001, Vipul Ved Prakash.  All rights reserved.
9## This code is free software; you can redistribute it and/or modify
10## it under the same terms as Perl itself.
11
12use Test::More;
13use Crypt::RSA::Errorhandler;
14
15plan tests => 6;
16
17my $i = 0;
18my $plaintext = "data";
19my @plaintext = qw(1 3 4 5);
20my %plaintext = qw(a 1 b 2);
21my $rsa = new Crypt::RSA::Errorhandler;
22
23$rsa->error ("Message too short", \$plaintext);
24is($rsa->errstr, "Message too short\n", "Set error string with scalar");
25is($plaintext, "", "\$plaintext is empty string");
26
27$rsa->error ("Out of range", \@plaintext);
28is($rsa->errstr, "Out of range\n", "Set error string with array");
29is_deeply(\@plaintext, [], "\@plaintext is empty array");
30
31$rsa->error ("Bad values", \%plaintext);
32is($rsa->errstr, "Bad values\n", "Set error string with hash");
33is_deeply(\%plaintext, {}, "\%plaintext is empty hash");
34
35