1#!/bin/sh
2
3test_description='test basic hash implementation'
4. ./test-lib.sh
5
6
7test_expect_success 'test basic SHA-1 hash values' '
8 test-tool sha1 </dev/null >actual &&
9 grep da39a3ee5e6b4b0d3255bfef95601890afd80709 actual &&
10 printf "a" | test-tool sha1 >actual &&
11 grep 86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 actual &&
12 printf "abc" | test-tool sha1 >actual &&
13 grep a9993e364706816aba3e25717850c26c9cd0d89d actual &&
14 printf "message digest" | test-tool sha1 >actual &&
15 grep c12252ceda8be8994d5fa0290a47231c1d16aae3 actual &&
16 printf "abcdefghijklmnopqrstuvwxyz" | test-tool sha1 >actual &&
17 grep 32d10c7b8cf96570ca04ce37f2a19d84240d3a89 actual &&
18 perl -e "$| = 1; print q{aaaaaaaaaa} for 1..100000;" | \
19 test-tool sha1 >actual &&
20 grep 34aa973cd4c4daa4f61eeb2bdbad27316534016f actual &&
21 printf "blob 0\0" | test-tool sha1 >actual &&
22 grep e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 actual &&
23 printf "blob 3\0abc" | test-tool sha1 >actual &&
24 grep f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f actual &&
25 printf "tree 0\0" | test-tool sha1 >actual &&
26 grep 4b825dc642cb6eb9a060e54bf8d69288fbee4904 actual
27'
28
29test_done