| Revision 4279,
1.2 KB
checked in by sam, 3 years ago
(diff) |
|
Add a check-zzuf-s-seed that tests whether all bits in a sequence have a
chance of being toggled.
|
-
Property svn:executable set to
*
|
| 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 | |
|---|
| 16 | start_test "zzuf -s test" |
|---|
| 17 | |
|---|
| 18 | for ratio in 1 0.1 0.01 0.001 0.0001; do |
|---|
| 19 | if test $ratio = 0.0001; then |
|---|
| 20 | bytes=1024 |
|---|
| 21 | elif test $ratio = 0.001; then |
|---|
| 22 | bytes=8192 |
|---|
| 23 | else |
|---|
| 24 | bytes=32768 |
|---|
| 25 | fi |
|---|
| 26 | new_test "$bytes B of zeroes, ratio $ratio" |
|---|
| 27 | zeroes=$(expr $bytes '*' 4) |
|---|
| 28 | passes=10 |
|---|
| 29 | while test $zeroes -gt 0 -a $passes -lt 200000; do |
|---|
| 30 | printf " doing $passes passes..." |
|---|
| 31 | zeroes=$($ZZUF -r $ratio -s $seed -A $ZZCAT -r $passes -x "fread(1,$bytes)" /dev/zero | $DIR/zzone $bytes $passes) |
|---|
| 32 | echo " $zeroes" |
|---|
| 33 | passes=$(expr '(' $passes '*' 7 + 3 ')' / 4) |
|---|
| 34 | done |
|---|
| 35 | if test $passes -lt 2000000; then |
|---|
| 36 | pass_test " ok" |
|---|
| 37 | else |
|---|
| 38 | pass_test " FAILED" |
|---|
| 39 | fi |
|---|
| 40 | done |
|---|
| 41 | |
|---|
| 42 | stop_test |
|---|
| 43 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.