]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/bmake/unit-tests/varmod-hash.mk
Update to bmake-20201101
[FreeBSD/FreeBSD.git] / contrib / bmake / unit-tests / varmod-hash.mk
1 # $NetBSD: varmod-hash.mk,v 1.5 2020/09/04 06:54:07 rillig Exp $
2 #
3 # Tests for the :hash variable modifier, which computes a 32-bit hash from
4 # the value of the expression.
5
6 # Test vectors for generating certain hashes.  Found by a brute force
7 # search over [a-z]{8}.
8 #
9 VECTORS+=       00000000 adjbuqnt
10 VECTORS+=       00000001 beiiyxdp
11 VECTORS+=       00000002 ajriwzqe
12 VECTORS+=       00000004 aimszzcb
13 VECTORS+=       00000008 afffvsgz
14 VECTORS+=       00000010 alkksbun
15 VECTORS+=       00000020 arqeianj
16 VECTORS+=       00000040 acgaltwv
17 VECTORS+=       00000080 addsjxec
18 VECTORS+=       00000100 acbozubm
19 VECTORS+=       00000200 acnbugtp
20 VECTORS+=       00000400 ajyfkpcl
21 VECTORS+=       00000800 akobyelz
22 VECTORS+=       00001000 aclmaggk
23 VECTORS+=       00002000 aauwlqiq
24 VECTORS+=       00004000 ankfvoqf
25 VECTORS+=       00008000 airtytts
26 VECTORS+=       00010000 bfwwrqfi
27 VECTORS+=       00020000 actwkzix
28 VECTORS+=       00040000 alsfbgvo
29 VECTORS+=       00080000 aioiauem
30 VECTORS+=       00100000 bxexhpji
31 VECTORS+=       00200000 awtxcwch
32 VECTORS+=       00400000 aoqpmqam
33 VECTORS+=       00800000 akgtvjhz
34 VECTORS+=       01000000 bcmsuvrm
35 VECTORS+=       02000000 aqnktorm
36 VECTORS+=       04000000 aweqylny
37 VECTORS+=       08000000 crvkuyze
38 VECTORS+=       10000000 alxiatjv
39 VECTORS+=       20000000 aezwuukx
40 VECTORS+=       40000000 abdpnifu
41 VECTORS+=       80000000 auusgoii
42 VECTORS+=       ffffffff ahnvmfdw
43
44 VECTORS+=       b2af338b ""
45 VECTORS+=       3360ac65 a
46 VECTORS+=       7747f046 ab
47 VECTORS+=       9ca87054 abc
48 VECTORS+=       880fe816 abcd
49 VECTORS+=       208fcbd3 abcde
50 VECTORS+=       d5d376eb abcdef
51 VECTORS+=       de41416c abcdefghijklmnopqrstuvwxyz
52
53 .for hash input in ${VECTORS}
54 .  if ${input:S,^""$,,:hash} != ${hash}
55 .    warning Expected ${hash} for ${input}, but was ${input:hash}.
56 .  endif
57 .endfor
58
59 all:
60         @echo ${12345:L:has}                    # modifier name too short
61         @echo ${12345:L:hash}                   # ok
62         @echo ${12345:L:hash=SHA-256}           # :hash does not accept '='
63         @echo ${12345:L:hasX}                   # misspelled
64         @echo ${12345:L:hashed}                 # modifier name too long