#!/bin/sh
#
#  check-zzuf-A-autoinc - test "zzuf -A" flag (auto-increment)
#  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 -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

