File: check-zzuf-A-autoinc

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 (39 lines) | stat: -rwxr-xr-x 1,227 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
#!/bin/sh
#
#  check-zzuf-A-autoinc - test "zzuf -A" flag (auto-increment)
#
#  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 -A test"

# Check -A with no fuzzing: output must match
new_test "zzuf -A -r0 zzat file-random file-random"
m1=$($ZZUF -m -r0 $ZZAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')
m2=$($ZZUF -m -A -r0 $ZZAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')
if [ "$m1" = "$m2" ]; then
    pass_test "ok"
else
    fail_test "$m1 != $m2"
fi

# Check -A with fuzzing: output must be different
new_test "zzuf -A -r0.1 zzat file-random file-random"
m1=$($ZZUF -m -r0.1 $ZZAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')
m2=$($ZZUF -m -A -r0.1 $ZZAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')
if [ "$m1" != "$m2" ]; then
    pass_test "ok"
else
    fail_test "$m1 = $m2"
fi

stop_test