source: zzuf/trunk/test/check-zzuf-s-seed @ 4281

Last change on this file since 4281 was 4281, checked in by sam, 5 years ago

Fix a bug in the -s test script that failed to detect failures.

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#!/bin/sh
2#
3#  check-zzuf-s-seed - zzuf seed efficiency statistic tests
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 -s test"
17
18t=0
19while : ; do
20  case $t in
21    0) ratio=1; bytes=32768 ;;
22    1) ratio=0.1; bytes=32768 ;;
23    2) ratio=0.01; bytes=32768 ;;
24    3) ratio=0.001; bytes=8192 ;;
25    4) ratio=0.0001; bytes=1024 ;;
26    *) break ;;
27  esac
28  t=$(expr $t + 1)
29  new_test "$bytes B of zeroes, ratio $ratio"
30  zeroes=$(expr $bytes '*' 4)
31  passes=10
32  while test $zeroes -gt 0 -a $passes -lt 200000; do
33    printf " doing $passes passes..."
34    zeroes=$($ZZUF -r $ratio -s $seed -A $ZZCAT -r $passes -x "fread(1,$bytes)" /dev/zero | $DIR/zzone $bytes $passes)
35    echo " $zeroes"
36    passes=$(expr '(' $passes '*' 7 + 3 ')' / 4)
37  done
38  if test $passes -lt 200000; then
39      pass_test " ok"
40  else
41      pass_test " FAILED"
42  fi
43done
44
45stop_test
46
Note: See TracBrowser for help on using the repository browser.