summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sleep.c2
-rw-r--r--tests/sort-time/README46
-rw-r--r--tests/sort-time/rand-gen139
3 files changed, 1 insertions, 186 deletions
diff --git a/src/sleep.c b/src/sleep.c
index 0c11b8e73..42a7cf904 100644
--- a/src/sleep.c
+++ b/src/sleep.c
@@ -1,5 +1,5 @@
/* sleep - delay for a specified amount of time.
- Copyright (C) 84, 1991-1997, 1999-2005, 2007-2008
+ Copyright (C) 84, 1991-1997, 1999-2005, 2007-2009
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/tests/sort-time/README b/tests/sort-time/README
deleted file mode 100644
index b74eac7ff..000000000
--- a/tests/sort-time/README
+++ /dev/null
@@ -1,46 +0,0 @@
-# determine whether it's worthwhile to add a --line-length=N option to sort.
-
-# Copyright (C) 1997 Free Software Foundation, Inc.
-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-# Add the option and perform this test:
-#
-# Test method:
-# ==============
-
-n_bytes=10000000
-time=/bin/time
-for line_len in 80 200 400 800 3000; do
-
- echo "line length: $line_len"
- write-file-of-size --bytes=$n_bytes --line-length=$line_len > in
-
- # sort a file with $n-char lines using the default of N=30
- $time sort in > x
-
- # sort the same file with --line-length=$n
- SORT_INITIAL_LINE_LENGTH=`expr $line_len + 1` $time sort in > x
-
- echo
- # compare run times
-done
-
-# do this on at least SunOS, Linux, Solaris
-
-# RESULTS:
-# Solaris5.5.1, x86 dual PPro/200: none
-# Linux 3.0.29 x86 P/100: 5-6% improvement for 80, 200, 400,
-# but 1-2% penalty for 800 and 3000
diff --git a/tests/sort-time/rand-gen b/tests/sort-time/rand-gen
deleted file mode 100644
index efc7f845d..000000000
--- a/tests/sort-time/rand-gen
+++ /dev/null
@@ -1,139 +0,0 @@
-#! /p/bin/perl -w
-# Print n pairs of floating point values.
-# Each value is in the range [0,1).
-# Usage: rand n
-
-# Copyright (C) 1997 Free Software Foundation, Inc.
-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-# Use only the basename from the path to this executable in error messages.
-($program_name = $0) =~ s|.*/||;
-
-require 'newgetopt.pl';
-$MAXINT = 0x7fffffff;
-
-undef $opt_help;
-undef $opt_verbose;
-undef $opt_integer;
-&usage if (&NGetOpt(('seed=i', 'range=s', 'help', 'items-per-line=i',
- 'format=s', 'integer', 'verbose')) == 0);
-
-&usage if (defined ($opt_help));
-
-&usage if (scalar (@ARGV) != 1 || $ARGV[0] !~ /^[0-9]+$/);
-$n = $ARGV[0];
-
-if (!defined ($opt_seed))
- {
- $opt_seed = time;
- print STDERR "seed= $opt_seed\n" if (defined ($opt_verbose));
- }
-
-srand ($opt_seed);
-
-# FIXME: make sure this number is positive.
-$opt_items_per_line = 1 if (!defined ($opt_items_per_line));
-
-if (defined ($opt_integer))
- {
- $opt_format = "%d" if (!defined ($opt_format));
- if (defined ($opt_range))
- {
- # FIXME: allow FP endpoints even though --integer specified?
- if ($opt_range =~ /^([0-9]+),([0-9]+)$/)
- {
- $lo = $1;
- $hi = $2;
- }
- else
- {
- print STDERR ("bad argument `$opt_range' to --range option\n");
- exit 2;
- }
- }
- else
- {
- $lo = 0;
- $hi = $MAXINT;
- }
-
- # Increase by one because we'll have to truncate to get integers.
- $hi += 1;
- }
-else
- {
- $opt_format = "%.15g" if (!defined ($opt_format));
- if (defined ($opt_range))
- {
- if ($opt_range =~ /^(-?[0-9.]+),(-?[0-9.]+)$/)
- {
- $lo = $1;
- $hi = $2;
- }
- else
- {
- print STDERR ("bad argument `$opt_range' to --range option\n");
- exit 2;
- }
- }
- else
- {
- $lo = 0.0;
- $hi = 1.0;
- }
- }
-
-# FIXME: warn if lo > hi.
-
-$range = $hi - $lo;
-
-if ($opt_items_per_line == 1)
- {
- for ($i=0; $i < $n; $i++)
- {
- printf $opt_format, $lo + rand($range);
- print "\n";
- }
- }
-else
- {
- $separator = ' ';
- for ($i=0; $i < $n; $i++)
- {
- for ($j=0; $j < $opt_items_per_line; $j++)
- {
- printf $opt_format, $lo + rand($range);
- print $j == $opt_items_per_line - 1 ? "\n" : $separator;
- }
- }
- }
-
-exit 0;
-
-sub usage
-{
- print STDERR <<EOF;
-Usage: $program_name [OPTIONS] n
- --help
- --seed=n
- --integer
- --items-per-line=n
- --range=i,j e.g. 3,9 or 1.5,33.9
- --format='%3d'
- --verbose (report the seed if it gets default value)
-EOF
- exit 2;
-}