source: zzuf/trunk/test/check-zzuf-f-fuzzing @ 4272

Last change on this file since 4272 was 4272, checked in by Sam Hocevar, 11 years ago

Rename check-flag-# tests to check-zzuf-#-#### with the option's long name,
to avoid problems with case-insensitive filesystems.

  • Property svn:executable set to *
File size: 2.6 KB
Line 
1#!/bin/sh
2#
3#  check-zzuf-f-fuzzing - test "zzuf -f" flag (fuzzing mode)
4#  Copyright (c) 2008-2010 Sam Hocevar <sam@hocevar.net>
5#                All Rights Reserved
6#
7#  This program is free software. It comes without any warranty, to
8#  the extent permitted by applicable law. You can redistribute it
9#  and/or modify it under the terms of the Do What The Fuck You Want
10#  To Public License, Version 2, as published by Sam Hocevar. See
11#  http://sam.zoy.org/wtfpl/COPYING for more details.
12#
13
14. "$(dirname "$0")/functions.inc"
15
16start_test "zzuf -f test"
17
18# Check -f xor: output must always be different
19new_test "zzuf -f xor < file-random"
20m1=$($ZZUF -m -r0 < "$DIR/file-random" | cut -f2 -d' ')
21m2=$($ZZUF -m -f xor < "$DIR/file-random" | cut -f2 -d' ')
22if [ "$m1" != "$m2" ]; then pass_test "ok"; else fail_test "$m1"; fi
23
24new_test "zzuf -f xor < file-00"
25m1=$($ZZUF -m -r0 < "$DIR/file-00" | cut -f2 -d' ')
26m2=$($ZZUF -m -f xor < "$DIR/file-00" | cut -f2 -d' ')
27if [ "$m1" != "$m2" ]; then pass_test "ok"; else fail_test "$m1"; fi
28
29new_test "zzuf -f xor < file-ff"
30m1=$($ZZUF -m -r0 < "$DIR/file-ff" | cut -f2 -d' ')
31m2=$($ZZUF -m -f xor < "$DIR/file-ff" | cut -f2 -d' ')
32if [ "$m1" != "$m2" ]; then pass_test "ok"; else fail_test "$m1"; fi
33
34# Check -f set: output must be different, except for file-ff
35new_test "zzuf -f set < file-random"
36m1=$($ZZUF -m -r0 < "$DIR/file-random" | cut -f2 -d' ')
37m2=$($ZZUF -m -f set < "$DIR/file-random" | cut -f2 -d' ')
38if [ "$m1" != "$m2" ]; then pass_test "ok"; else fail_test "$m1"; fi
39
40new_test "zzuf -f set < file-00"
41m1=$($ZZUF -m -r0 < "$DIR/file-00" | cut -f2 -d' ')
42m2=$($ZZUF -m -f set < "$DIR/file-00" | cut -f2 -d' ')
43if [ "$m1" != "$m2" ]; then pass_test "ok"; else fail_test "$m1"; fi
44
45new_test "zzuf -f set < file-ff"
46m1=$($ZZUF -m -r0 < "$DIR/file-ff" | cut -f2 -d' ')
47m2=$($ZZUF -m -f set < "$DIR/file-ff" | cut -f2 -d' ')
48if [ "$m1" = "$m2" ]; then pass_test "ok"; else fail_test "$m1 != $m2"; fi
49
50# Check -f unset: output must be different, except for file-00
51new_test "zzuf -f unset < file-random"
52m1=$($ZZUF -m -r0 < "$DIR/file-random" | cut -f2 -d' ')
53m2=$($ZZUF -m -f unset < "$DIR/file-random" | cut -f2 -d' ')
54if [ "$m1" != "$m2" ]; then pass_test "ok"; else fail_test "$m1"; fi
55
56new_test "zzuf -f unset < file-00"
57m1=$($ZZUF -m -r0 < "$DIR/file-00" | cut -f2 -d' ')
58m2=$($ZZUF -m -f unset < "$DIR/file-00" | cut -f2 -d' ')
59if [ "$m1" = "$m2" ]; then pass_test "ok"; else fail_test "$m1 != $m2"; fi
60
61new_test "zzuf -f unset < file-ff"
62m1=$($ZZUF -m -r0 < "$DIR/file-ff" | cut -f2 -d' ')
63m2=$($ZZUF -m -f unset < "$DIR/file-ff" | cut -f2 -d' ')
64if [ "$m1" != "$m2" ]; then pass_test "ok"; else fail_test "$m1"; fi
65
66stop_test
67
Note: See TracBrowser for help on using the repository browser.