factor: lessen print_uuint recursion
[coreutils.git] / tests / cksum / sm3sum.pl
blob1e8a0b3da5425acd3e3d87cff5e62ebf1497602f
1 #!/usr/bin/perl
2 # Test "cksum -a sm3".
4 # Copyright (C) 2021-2024 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 use strict;
21 (my $program_name = $0) =~ s|.*/||;
23 # Turn off localization of executable's output.
24 @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
26 my $sha_degenerate =
27 "1ab21d8355cfa17f8e61194831e81a8f22bec8c728fefb747ed035eb5082aa2b";
29 my @Tests =
31 ['s1', {IN=> {f=> ''}},
32 {OUT=>"$sha_degenerate f\n"}],
33 ['s2', {IN=> {f=> 'a'}},
34 {OUT=>"623476ac18f65a2909e43c7fec61b49c7e764a91a18ccb82f1917a29c86c5e88 f\n"}],
35 ['s3', {IN=> {f=> 'abc'}},
36 {OUT=>"66c7f0f462eeedd9d1f2d46bdc10e4e24167c4875cf2f7a2297da02b8f4ba8e0 f\n"}],
37 ['s4',
38 {IN=> {f=> 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq'}},
39 {OUT=>"639b6cc5e64d9e37a390b192df4fa1ea0720ab747ff692b9f38c4e66ad7b8c05 f\n"}],
40 ['s8', {IN=> {f=> 'a' x 1000000}},
41 {OUT=>"c8aaf89429554029e231941a2acc0ad61ff2a5acd8fadd25847a3a732b3b02c3 f\n"}],
44 # Insert the arguments for each test.
45 my $t;
46 foreach $t (@Tests)
48 splice @$t, 1, 0, '--untagged --text -a sm3'
51 my $save_temps = $ENV{DEBUG};
52 my $verbose = $ENV{VERBOSE};
54 my $prog = 'cksum';
55 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
56 exit $fail;