From 0a82c5a7400ed57e7d2602f1625ec7824f51486d Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 14 Jan 2010 00:26:21 +0000 Subject: [PATCH] Add a check-flag-A test and rename check-md5 to check-flag-m. --- test/Makefile.am | 4 ++-- test/check-flag-A | 39 ++++++++++++++++++++++++++++++++ test/{check-md5 => check-flag-m} | 4 ++-- 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100755 test/check-flag-A rename test/{check-md5 => check-flag-m} (91%) diff --git a/test/Makefile.am b/test/Makefile.am index 013813e..204ca04 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -3,8 +3,8 @@ 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-md5 check-overflow check-memory check-div0 \ - check-rng check-utils +TESTS = check-build check-flag-A check-flag-m \ + check-overflow check-memory check-div0 check-rng check-utils echo-sources: ; echo $(SOURCES) diff --git a/test/check-flag-A b/test/check-flag-A new file mode 100755 index 0000000..65f7152 --- /dev/null +++ b/test/check-flag-A @@ -0,0 +1,39 @@ +#!/bin/sh +# +# check-flag-A - test "zzuf -A" flag (auto-increment) +# Copyright (c) 2008-2010 Sam Hocevar +# 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 -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") +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 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") +if [ "$m1" != "$m2" ]; then + pass_test "ok" +else + fail_test "$m1 = $m2" +fi + +stop_test + diff --git a/test/check-md5 b/test/check-flag-m similarity index 91% rename from test/check-md5 rename to test/check-flag-m index 28db367..830521e 100755 --- a/test/check-md5 +++ b/test/check-flag-m @@ -1,6 +1,6 @@ #!/bin/sh # -# check-md5 - check that zzuf properly computes md5 checksums +# check-flag-m - test "zzuf -m" flag (md5 checksums) # Copyright (c) 2008-2010 Sam Hocevar # All Rights Reserved # @@ -26,7 +26,7 @@ checkmd5() fi } -start_test "zzuf MD5 test" +start_test "zzuf -m test" checkmd5 "printf ''" d41d8cd98f00b204e9800998ecf8427e checkmd5 echo 68b329da9893e34099c7d8ad5cb9c940