#!/bin/sh
#
# Check that the average transfer rate counter changes, but not more than it
# should.

# Transfer 210 bytes as 100 bytes, a 1 second gap, 110 bytes, and another 1
# second gap.
#
(dd if=/dev/zero bs=100 count=1 2>/dev/null;
 sleep 1;
 dd if=/dev/zero bs=110 count=1 2>/dev/null;
 sleep 1;
) | $PROG -f -i 0.5 -a >/dev/null 2>$TMP1

# Count the number of rates output that are below 90.
#
NUM=`tr '\r' '\n' < $TMP1 | tr -dc '0-9\n' | sed '/^$/d' | awk '$1<90{print}' | wc -l | tr -d ' '`

# All the output rates should be above 90 since the average rate will always
# be around 100 bytes per second.
#
test $NUM -lt 1

# EOF
