diff options
| author | fukachan <fukachan> | 2002-03-23 12:49:49 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2002-03-23 12:49:49 +0000 |
| commit | 3d42b337952068797e5a0fe1a5b178ddfa018fef (patch) | |
| tree | db9b99a214f506c645991a681a08c58555a1a27c /cpan/dist/Crypt-UnixCrypt/test.pl | |
| parent | 6374559b4a39d80f8eec1e3aeb118b4485b6e78e (diff) | |
| download | fml8-3d42b337952068797e5a0fe1a5b178ddfa018fef.tar.gz fml8-3d42b337952068797e5a0fe1a5b178ddfa018fef.tar.bz2 fml8-3d42b337952068797e5a0fe1a5b178ddfa018fef.zip | |
Initial revision
Diffstat (limited to 'cpan/dist/Crypt-UnixCrypt/test.pl')
| -rw-r--r-- | cpan/dist/Crypt-UnixCrypt/test.pl | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/cpan/dist/Crypt-UnixCrypt/test.pl b/cpan/dist/Crypt-UnixCrypt/test.pl new file mode 100644 index 00000000..7b9c04bb --- /dev/null +++ b/cpan/dist/Crypt-UnixCrypt/test.pl @@ -0,0 +1,45 @@ +BEGIN { + $| = 1; + print "1..22\n"; # Adjust to the number of tests implemented + $Crypt::UnixCrypt::OVERRIDE_BUILTIN = 1; # do use our own crypt() +} +END {print "not ok 1\n" unless $loaded;} +use Crypt::UnixCrypt; +$loaded = 1; +print "ok 1\n"; + +# Thanks to Tom Phoenix, rootbeer@redcat.com, for these test cases +my %passwords = qw{ + baVNbYZEf7LDE fred + fr7q2GbYzYnUY fred + frDRU8pKCvhno barney + bavBxSScsQx4c barney + frnyAy5uqxI72 Fred + frOnUcrBFxA0. FRED + loS9ozwAlfL0. thisstringistoolong + on0GQrELiWzlk onlythefirst8charsareused + puTVTxaAZz6sw I've%got_punc!tu~a$tion*marks? + moaj75vMGk/4s !@$%^&*()~ +}; + +my $start = 2; +for (sort keys %passwords) { + my $pass = $passwords{$_}; + my $crypted = crypt $pass, $_; + print "# Expected $_ got $crypted ($pass)\nnot " + if $_ ne $crypted; + print "ok ", $start++, "\n"; + # Try a false salt + my $original = $_; + s/^(..)(.*)$/ $1 . reverse $2 /e; + $crypted = crypt $pass, $_; + print "# crypt is returning the salt!\nnot " + if $_ eq $crypted; + print "ok ", $start++, "\n"; +} + +print "not " unless + crypt("fr","someverylongstring") eq + crypt("fr","somevery"); +print "ok ", $start++, "\n"; + |
