summaryrefslogtreecommitdiff
path: root/tests/md5sum/Test.pm
blob: fa422888a0375740cc66bba7f8bc8a592e5e6d4d (plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*-perl-*-
package Test;
require 5.002;
use strict;

sub test_vector
{
  my @tvec =
    (
     # test-name options input expected-output expected-return-code
     #
     ['1', '', '',		'd41d8cd98f00b204e9800998ecf8427e', 0],
     ['2', '', 'a',		'0cc175b9c0f1b6a831c399e269772661', 0],
     ['3', '', 'abc',		'900150983cd24fb0d6963f7d28e17f72', 0],
     ['4', '', 'message digest', 'f96b697d7cb7938d525a2f31aaf161d0', 0],
     ['5', '', 'abcdefghijklmnopqrstuvwxyz',
      'c3fcd3d76192e4007dfb496cca67e13b', 0],
     ['6', '',
      'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',
      'd174ab98d277d9f5a5611c2c9f419d9f', 0],
     ['7', '', '1234567890123456789012345678901234567890'
      . '1234567890123456789012345678901234567890',
      '57edf4a22be3c955ac49da2e2107b67a', 0],
     );
  my @tv;

  # Append two spaces, the input file name (-), and a newline to each
  # expected output string.
  my $t;
  foreach $t (@tvec)
    {
      my ($test_name, $flags, $in, $exp, $ret) = @$t;
      push (@tv, [$test_name, $flags, $in, "$exp  -\n", $ret]);
      $Test::input_via{$test_name} = {REDIR => 0, PIPE => 0};
    }

  return @tv;
}

1;