File: check-zzuf-f-fuzzing

package info (click to toggle)
zzuf 0.15-1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 2,280 kB
  • ctags: 916
  • sloc: ansic: 7,266; sh: 581; cpp: 352; makefile: 80
file content (67 lines) | stat: -rwxr-xr-x 2,655 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
#
#  check-zzuf-f-fuzzing - test "zzuf -f" flag (fuzzing mode)
#
#  Copyright © 2002—2015 Sam Hocevar <sam@hocevar.net>
#
#  This program is free software. It comes without any warranty, to
#  the extent permitted by applicable law. You can redistribute it
#  and/or modify it under the terms of the Do What the Fuck You Want
#  to Public License, Version 2, as published by the WTFPL Task Force.
#  See http://www.wtfpl.net/ for more details.
#

. "$(dirname "$0")/functions.inc"

start_test "zzuf -f test"

# Check -f xor: output must always be different
new_test "zzuf -f xor < file-random"
m1=$($ZZUF -m -r0 < "$DIR/file-random" | cut -f2 -d' ')
m2=$($ZZUF -m -f xor < "$DIR/file-random" | cut -f2 -d' ')
if [ "$m1" != "$m2" ]; then pass_test "ok"; else fail_test "$m1"; fi

new_test "zzuf -f xor < file-00"
m1=$($ZZUF -m -r0 < "$DIR/file-00" | cut -f2 -d' ')
m2=$($ZZUF -m -f xor < "$DIR/file-00" | cut -f2 -d' ')
if [ "$m1" != "$m2" ]; then pass_test "ok"; else fail_test "$m1"; fi

new_test "zzuf -f xor < file-ff"
m1=$($ZZUF -m -r0 < "$DIR/file-ff" | cut -f2 -d' ')
m2=$($ZZUF -m -f xor < "$DIR/file-ff" | cut -f2 -d' ')
if [ "$m1" != "$m2" ]; then pass_test "ok"; else fail_test "$m1"; fi

# Check -f set: output must be different, except for file-ff
new_test "zzuf -f set < file-random"
m1=$($ZZUF -m -r0 < "$DIR/file-random" | cut -f2 -d' ')
m2=$($ZZUF -m -f set < "$DIR/file-random" | cut -f2 -d' ')
if [ "$m1" != "$m2" ]; then pass_test "ok"; else fail_test "$m1"; fi

new_test "zzuf -f set < file-00"
m1=$($ZZUF -m -r0 < "$DIR/file-00" | cut -f2 -d' ')
m2=$($ZZUF -m -f set < "$DIR/file-00" | cut -f2 -d' ')
if [ "$m1" != "$m2" ]; then pass_test "ok"; else fail_test "$m1"; fi

new_test "zzuf -f set < file-ff"
m1=$($ZZUF -m -r0 < "$DIR/file-ff" | cut -f2 -d' ')
m2=$($ZZUF -m -f set < "$DIR/file-ff" | cut -f2 -d' ')
if [ "$m1" = "$m2" ]; then pass_test "ok"; else fail_test "$m1 != $m2"; fi

# Check -f unset: output must be different, except for file-00
new_test "zzuf -f unset < file-random"
m1=$($ZZUF -m -r0 < "$DIR/file-random" | cut -f2 -d' ')
m2=$($ZZUF -m -f unset < "$DIR/file-random" | cut -f2 -d' ')
if [ "$m1" != "$m2" ]; then pass_test "ok"; else fail_test "$m1"; fi

new_test "zzuf -f unset < file-00"
m1=$($ZZUF -m -r0 < "$DIR/file-00" | cut -f2 -d' ')
m2=$($ZZUF -m -f unset < "$DIR/file-00" | cut -f2 -d' ')
if [ "$m1" = "$m2" ]; then pass_test "ok"; else fail_test "$m1 != $m2"; fi

new_test "zzuf -f unset < file-ff"
m1=$($ZZUF -m -r0 < "$DIR/file-ff" | cut -f2 -d' ')
m2=$($ZZUF -m -f unset < "$DIR/file-ff" | cut -f2 -d' ')
if [ "$m1" != "$m2" ]; then pass_test "ok"; else fail_test "$m1"; fi

stop_test