Mercurial > hg > toybox
comparison tests/sha1sum.test @ 1485:8700cbe1cb29 draft
Move testsuite out of scripts/test into its own top level tests directory, and make ctrl-c kill "make test" more reliably.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 20 Sep 2014 13:09:14 -0500 |
parents | scripts/test/sha1sum.test@49608ab4d592 |
children |
comparison
equal
deleted
inserted
replaced
1484:19435f12ec63 | 1485:8700cbe1cb29 |
---|---|
1 #!/bin/bash | |
2 | |
3 [ -f testing.sh ] && . testing.sh | |
4 | |
5 #testing "name" "command" "result" "infile" "stdin" | |
6 | |
7 # These tests are based on RFC3174 which were based on FIPS PUB 180-1 | |
8 | |
9 testing "sha1sum TEST1" \ | |
10 "sha1sum" \ | |
11 "a9993e364706816aba3e25717850c26c9cd0d89d -\n" \ | |
12 "" "abc" | |
13 | |
14 testing "sha1sum TEST2" \ | |
15 "sha1sum" \ | |
16 "84983e441c3bd26ebaae4aa1f95129e5e54670f1 -\n" \ | |
17 "" "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" | |
18 | |
19 testing "sha1sum TEST3" \ | |
20 'dd if=/dev/zero bs=1000 count=1000 2>/dev/null | tr \\0 a | sha1sum' \ | |
21 "34aa973cd4c4daa4f61eeb2bdbad27316534016f -\n" \ | |
22 "" "" | |
23 | |
24 testing "sha1sum TEST4" \ | |
25 'for i in `seq 1 10`; do echo -n 0123456701234567012345670123456701234567012345670123456701234567 ; done | sha1sum' \ | |
26 "dea356a2cddd90c7a7ecedc5ebb563934f460452 -\n" \ | |
27 "" "" | |
28 | |
29 echo -n "abc" > file1 | |
30 echo -n "def" > file2 | |
31 testing "sha1sum" \ | |
32 "sha1sum" \ | |
33 "a9993e364706816aba3e25717850c26c9cd0d89d -\n" \ | |
34 "" "abc" | |
35 | |
36 testing "sha1sum -" \ | |
37 "sha1sum -" \ | |
38 "a9993e364706816aba3e25717850c26c9cd0d89d -\n" \ | |
39 "" "abc" | |
40 | |
41 testing "sha1sum file" \ | |
42 "sha1sum file1" \ | |
43 "a9993e364706816aba3e25717850c26c9cd0d89d file1\n" \ | |
44 "" "" | |
45 | |
46 testing "sha1sum file1 file2" \ | |
47 "sha1sum file1 file2" \ | |
48 "a9993e364706816aba3e25717850c26c9cd0d89d file1\n589c22335a381f122d129225f5c0ba3056ed5811 file2\n" \ | |
49 "" "" | |
50 | |
51 testing "sha1sum file1 file2 -" \ | |
52 "sha1sum file1 file2 -" \ | |
53 "a9993e364706816aba3e25717850c26c9cd0d89d file1\n589c22335a381f122d129225f5c0ba3056ed5811 file2\na9993e364706816aba3e25717850c26c9cd0d89d -\n" \ | |
54 "" "abc" | |
55 | |
56 rm -f file1 file2 | |
57 |