*** empty log message ***
[coreutils.git] / tests / sha1sum / basic-1
blob8e148267ad663e929597386518b366979cce5f98
1 #!/bin/sh
3 : ${PERL=perl}
4 : ${srcdir=.}
6 case "$PERL" in
7 *'missing perl')
8 echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test"
9 exit 77
11 esac
13 exec $PERL -w -I$srcdir/.. -MFetish -- - <<\EOF
14 require 5.003;
15 use strict;
17 (my $program_name = $0) =~ s|.*/||;
19 # Turn off localisation of executable's ouput.
20 @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
22 my $sha_degenerate = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
24 my @Tests =
26 ['s1', {IN=> {f=> ''}},
27 {OUT=>"$sha_degenerate f\n"}],
28 ['s2', {IN=> {f=> 'a'}},
29 {OUT=>"86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 f\n"}],
30 ['s3', {IN=> {f=> 'abc'}},
31 {OUT=>"a9993e364706816aba3e25717850c26c9cd0d89d f\n"}],
32 ['s4',
33 {IN=> {f=> 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq'}},
34 {OUT=>"84983e441c3bd26ebaae4aa1f95129e5e54670f1 f\n"}],
35 ['s5', {IN=> {f=> 'abcdefghijklmnopqrstuvwxyz'}},
36 {OUT=>"32d10c7b8cf96570ca04ce37f2a19d84240d3a89 f\n"}],
37 ['s6', {IN=> {f=> join ('', 'A'..'Z', 'a'..'z', '0'..'9')}},
38 {OUT=>"761c457bf73b14d27e9e9265c46f4b4dda11f940 f\n"}],
39 ['s7', {IN=> {f=> '1234567890' x 8}},
40 {OUT=>"50abf5706a150990a08b2c5ea40fa0e585554732 f\n"}],
41 ['bs-sha', {IN=> {".\\foo"=> ''}},
42 {OUT=>"\\$sha_degenerate .\\\\foo\n"}],
45 # Insert the `--text' argument for each test.
46 my $t;
47 foreach $t (@Tests)
49 splice @$t, 1, 0, '--text';
52 my $save_temps = $ENV{DEBUG};
53 my $verbose = $ENV{VERBOSE};
55 my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
56 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
57 exit $fail;
58 EOF