annotate tests/sha1sum.test @ 1499:319e79bab052 draft

Separate more commands so single.sh can build them standalone.
author Rob Landley <rob@landley.net>
date Fri, 26 Sep 2014 18:42:23 -0500
parents 8700cbe1cb29
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
742
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
1 #!/bin/bash
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
2
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
3 [ -f testing.sh ] && . testing.sh
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
4
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
5 #testing "name" "command" "result" "infile" "stdin"
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
6
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
7 # These tests are based on RFC3174 which were based on FIPS PUB 180-1
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
8
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
9 testing "sha1sum TEST1" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
10 "sha1sum" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
11 "a9993e364706816aba3e25717850c26c9cd0d89d -\n" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
12 "" "abc"
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
13
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
14 testing "sha1sum TEST2" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
15 "sha1sum" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
16 "84983e441c3bd26ebaae4aa1f95129e5e54670f1 -\n" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
17 "" "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
18
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
19 testing "sha1sum TEST3" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
20 'dd if=/dev/zero bs=1000 count=1000 2>/dev/null | tr \\0 a | sha1sum' \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
21 "34aa973cd4c4daa4f61eeb2bdbad27316534016f -\n" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
22 "" ""
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
23
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
24 testing "sha1sum TEST4" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
25 'for i in `seq 1 10`; do echo -n 0123456701234567012345670123456701234567012345670123456701234567 ; done | sha1sum' \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
26 "dea356a2cddd90c7a7ecedc5ebb563934f460452 -\n" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
27 "" ""
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
28
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
29 echo -n "abc" > file1
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
30 echo -n "def" > file2
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
31 testing "sha1sum" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
32 "sha1sum" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
33 "a9993e364706816aba3e25717850c26c9cd0d89d -\n" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
34 "" "abc"
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
35
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
36 testing "sha1sum -" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
37 "sha1sum -" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
38 "a9993e364706816aba3e25717850c26c9cd0d89d -\n" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
39 "" "abc"
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
40
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
41 testing "sha1sum file" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
42 "sha1sum file1" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
43 "a9993e364706816aba3e25717850c26c9cd0d89d file1\n" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
44 "" ""
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
45
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
46 testing "sha1sum file1 file2" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
47 "sha1sum file1 file2" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
48 "a9993e364706816aba3e25717850c26c9cd0d89d file1\n589c22335a381f122d129225f5c0ba3056ed5811 file2\n" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
49 "" ""
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
50
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
51 testing "sha1sum file1 file2 -" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
52 "sha1sum file1 file2 -" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
53 "a9993e364706816aba3e25717850c26c9cd0d89d file1\n589c22335a381f122d129225f5c0ba3056ed5811 file2\na9993e364706816aba3e25717850c26c9cd0d89d -\n" \
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
54 "" "abc"
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
55
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
56 rm -f file1 file2
49608ab4d592 Adding sha1sum tests based on RFC 3174
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
57