mirror of
https://git.sr.ht/~cismonx/bookmarkfs
synced 2025-06-07 19:58:50 +00:00
- Do not exit with status 99. It is considered a "hard failure" in Autotest, and cleanup script won't be executed. - Fix ATX_FEAT_PREREQ(). - Remove unneeded helper macros. - Add more log output.
40 lines
1 KiB
Text
40 lines
1 KiB
Text
dnl
|
|
dnl Copyright (C) 2025 CismonX <admin@cismon.net>
|
|
dnl
|
|
dnl Copying and distribution of this file, with or without modification,
|
|
dnl are permitted in any medium without royalty,
|
|
dnl provided the copyright notice and this notice are preserved.
|
|
dnl This file is offered as-is, without any warranty.
|
|
dnl
|
|
|
|
AT_SETUP([util lib: prng])
|
|
AT_KEYWORDS([lib prng])
|
|
|
|
# This test only serves as a basic sanity check.
|
|
#
|
|
# For reliable testing of PRNGs, see <https://prng.di.unimi.it/#quality>.
|
|
ATX_CHECK_LIB([
|
|
gen_num() {
|
|
check-util-lib prng -s$1 -n$2
|
|
}
|
|
|
|
seed=$(ath_fn_prng_seed)
|
|
count=32
|
|
|
|
num_1=$(gen_num $seed $count)
|
|
num_2=$(gen_num $seed $count)
|
|
num_3=$(gen_num $seed $count)
|
|
|
|
if test "$num_1" != "$num_2" -o "$num_2" != "$num_3"; then
|
|
echo 'bad prng: inconsistent number sequence'
|
|
exit 1
|
|
fi
|
|
|
|
uniq_count=$(echo "$num_1" | sort | uniq | wc -l)
|
|
if test $uniq_count -ne $count; then
|
|
echo 'bad prng: getting duplicates too soon'
|
|
exit 1
|
|
fi
|
|
])
|
|
|
|
AT_CLEANUP
|