changed regression test scripts

This commit is contained in:
hyung-hwan 2009-07-01 07:14:39 +00:00
parent e78de0f959
commit dd36ca0725
6 changed files with 1960 additions and 36 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: misc.c 210 2009-06-24 08:29:33Z hyunghwan.chung $ * $Id: misc.c 219 2009-06-30 13:14:39Z hyunghwan.chung $
* *
Copyright 2006-2009 Chung, Hyung-Hwan. Copyright 2006-2009 Chung, Hyung-Hwan.
@ -57,7 +57,6 @@ qse_long_t qse_awk_strxtolong (
/*while (QSE_AWK_ISSPACE(awk,*p)) p++;*/ /*while (QSE_AWK_ISSPACE(awk,*p)) p++;*/
/* check for a sign */ /* check for a sign */
/*while (*p != QSE_T('\0')) */
while (p < end) while (p < end)
{ {
if (*p == QSE_T('-')) if (*p == QSE_T('-'))
@ -102,7 +101,6 @@ qse_long_t qse_awk_strxtolong (
} }
/* process the digits */ /* process the digits */
/*while (*p != QSE_T('\0'))*/
while (p < end) while (p < end)
{ {
if (*p >= QSE_T('0') && *p <= QSE_T('9')) if (*p >= QSE_T('0') && *p <= QSE_T('9'))

View File

@ -1,3 +1,34 @@
BEGIN { FS = "\t"; } BEGIN { FS = "\t"; }
{ pop[$4] += $3; } { pop[$4] += $3; }
END { for (name in pop) print name, pop[name]; }
END {
count = 0;
for (name in pop)
{
for (i = 0; i < count; i++)
{
if (name < x[i])
{
for (j = count; j > i; j--)
{
x[j] = x[j-1];
y[j] = y[j-1];
}
break;
}
}
x[i] = name;
y[i] = pop[name];
count++;
}
for (i = 0; i < count; i++)
{
print x[i], y[i];
}
}

View File

@ -35,7 +35,6 @@ function qsort(A, left, right, i, last) {
last = left last = left
for (i = left+1; i <= right; i++) for (i = left+1; i <= right; i++)
{ {
# print A[i] "/" A[left] "....." (A[i] < A[left])
if (A[i] < A[left]) if (A[i] < A[left])
{ {
swap(A, ++last, i) swap(A, ++last, i)

1861
qse/regress/awk/regress.out Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,22 +2,34 @@
echo_so() echo_so()
{ {
echo "--------------------------------------------------------------------------------" tput smso
#tput smso
while [ $# -gt 0 ] while [ $# -gt 0 ]
do do
echo -n "$1 " echo -n "$1 "
shift shift
done done
echo echo
#tput rmso tput rmso
}
echo_title()
{
echo "--------------------------------------------------------------------------------"
while [ $# -gt 0 ]
do
echo -n "$1 "
echo -n "$1 " >/dev/stderr
shift
done
echo
echo > /dev/stderr
echo "--------------------------------------------------------------------------------" echo "--------------------------------------------------------------------------------"
} }
print_usage() print_usage()
{ {
echo "Usage: $0 init" echo_so "Usage: $0 init"
echo " $0 test" echo_so " $0 test"
} }
################### ###################
@ -26,6 +38,7 @@ print_usage()
QSEAWK=${QSEAWK:=../../cmd/awk/qseawk} QSEAWK=${QSEAWK:=../../cmd/awk/qseawk}
TMPFILE="${TMPFILE:=./regress.temp}" TMPFILE="${TMPFILE:=./regress.temp}"
OUTFILE="${OUTFILE:=./regress.out}"
PROGS=" PROGS="
cou-001.awk/cou.dat// cou-001.awk/cou.dat//
@ -137,6 +150,8 @@ PROGS="
exit 1; exit 1;
} }
run_scripts()
{
echo "${PROGS}" > "${TMPFILE}" echo "${PROGS}" > "${TMPFILE}"
while read prog while read prog
@ -157,11 +172,32 @@ do
[ -z "${redinfile}" ] && redinfile="/dev/stdin" [ -z "${redinfile}" ] && redinfile="/dev/stdin"
echo_so "${QSEAWK} ${awkopts} -f ${script} ${datafile} <${redinfile} 2>&1" echo_title "${QSEAWK} ${awkopts} -f ${script} ${datafile} <${redinfile} 2>&1"
${QSEAWK} ${awkopts} -f ${script} ${datafile} <${redinfile} 2>&1 ${QSEAWK} ${awkopts} -f ${script} ${datafile} <${redinfile} 2>&1
done < "${TMPFILE}" done < "${TMPFILE}"
rm -f "${TMPFILE}" rm -f "${TMPFILE}"
}
case $1 in
init)
run_scripts > "${OUTFILE}"
;;
test)
run_scripts > "${OUTFILE}.temp"
diff -q "${OUTFILE}" "${OUTFILE}.temp" || {
echo_so "ERROR: ${OUTFILE} differs from ${OUTFILE}.temp."
echo_so " Check the scripts and output files for any errors."
exit 1
}
rm -f "${OUTFILE}.temp"
;;
*)
echo_so "USAGE: $0 init"
echo_so " $0 test"
exit 1
;;
esac
exit 0 exit 0

View File

@ -10,7 +10,6 @@
for (i = 1; i <= NF; i++) freq[$i]++; for (i = 1; i <= NF; i++) freq[$i]++;
} }
#/[^kkka-bcx-dd-y]|abc|def/
END { END {
for (word in freq) for (word in freq)