Add a check-flag-f test.
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ EXTRA_DIST = $(TESTS) functions.inc file-00 file-ff file-random file-text
|
||||
|
||||
noinst_PROGRAMS = zzero zznop bug-overflow bug-memory bug-div0
|
||||
|
||||
TESTS = check-build check-flag-A check-flag-m \
|
||||
TESTS = check-build check-flag-A check-flag-f check-flag-m \
|
||||
check-overflow check-memory check-div0 check-rng check-utils
|
||||
|
||||
echo-sources: ; echo $(SOURCES)
|
||||
|
||||
+4
-4
@@ -17,8 +17,8 @@ start_test "zzuf -A test"
|
||||
|
||||
# Check -A with no fuzzing: output must match
|
||||
new_test "zzuf -A -r0 zzcat file-random file-random"
|
||||
m1=$($ZZUF -m -r0 $ZZCAT "$DIR/file-random" "$DIR/file-random")
|
||||
m2=$($ZZUF -m -A -r0 $ZZCAT "$DIR/file-random" "$DIR/file-random")
|
||||
m1=$($ZZUF -m -r0 $ZZCAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')
|
||||
m2=$($ZZUF -m -A -r0 $ZZCAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')
|
||||
if [ "$m1" = "$m2" ]; then
|
||||
pass_test "ok"
|
||||
else
|
||||
@@ -27,8 +27,8 @@ fi
|
||||
|
||||
# Check -A with fuzzing: output must be different
|
||||
new_test "zzuf -A -r0.1 zzcat file-random file-random"
|
||||
m1=$($ZZUF -m -r0.1 $ZZCAT "$DIR/file-random" "$DIR/file-random")
|
||||
m2=$($ZZUF -m -A -r0.1 $ZZCAT "$DIR/file-random" "$DIR/file-random")
|
||||
m1=$($ZZUF -m -r0.1 $ZZCAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')
|
||||
m2=$($ZZUF -m -A -r0.1 $ZZCAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')
|
||||
if [ "$m1" != "$m2" ]; then
|
||||
pass_test "ok"
|
||||
else
|
||||
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# check-flag-f - test "zzuf -f" flag (fuzzing mode)
|
||||
# Copyright (c) 2008-2010 Sam Hocevar <sam@hocevar.net>
|
||||
# All Rights Reserved
|
||||
#
|
||||
# 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 Sam Hocevar. See
|
||||
# http://sam.zoy.org/wtfpl/COPYING 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
|
||||
|
||||
Reference in New Issue
Block a user