diff options
Diffstat (limited to 'tests/factor/run.sh')
-rwxr-xr-x | tests/factor/run.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/factor/run.sh b/tests/factor/run.sh new file mode 100755 index 000000000..6ff24c370 --- /dev/null +++ b/tests/factor/run.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# Test the factor rewrite. +# Expect to be invoked via a file whose basename matches +# /^(\d+)\-(\d+)\-([\da-f]{40})\.sh$/ +# The test is to run this command +# seq $1 $2 | factor | shasum -c --status <(echo $3 -) +# I.e., to ensure that the factorizations of integers $1..$2 +# match what we expect. + +# Copyright (C) 2012 Free Software Foundation, Inc. + +. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src + +# Don't run these tests by default. +very_expensive_ + +print_ver_ factor seq + +# Remove the ".sh" suffix: +t=${ME_%.sh} + +# Make IFS include "-", so that a simple "set" will separate the args: +IFS=-$IFS +set $t +echo "$3 -" > exp + +f=1 +seq $1 $2 | factor | shasum -c --status exp && f=0 + +Exit $f |