File: compare_forever.t

package info (click to toggle)
libcrypt-unixcrypt-xs-perl 0.08-1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze, wheezy
  • size: 164 kB
  • ctags: 229
  • sloc: ansic: 652; makefile: 54; perl: 15
file content (26 lines) | stat: -rw-r--r-- 699 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use Test::More  skip_all => "your machine is to slow for that much tests";

# feeling boring? run this test for years ;-)
#use Test::More qw/no_plan/;    # eigentlich 58 ** 13 but this is too large

BEGIN { use_ok "Crypt::UnixCrypt_XS"; }

SKIP: {
  eval { require Algorithm::Loops };
  skip "Algorithm::Loops is not installed" if $@;

  my @chars = ( "a" .. "z", "A" .. "Z", 0 .. 9 );

  my $depth = 13;
  Algorithm::Loops::NestedLoops(
    [ ( [ 0 .. $#chars ] ) x $depth, ],
    sub {
      my ( $passwd, $salt ) = join( '', @chars[@_] ) =~ /(.{11})(..)/;
      ok(
          crypt( $passwd, $salt ) eq
            Crypt::UnixCrypt_XS::crypt( $passwd, $salt ),
          $0
      );
    }
  );
}