changed regression test scripts
This commit is contained in:
parent
e78de0f959
commit
dd36ca0725
@ -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.
|
||||
|
||||
@ -57,7 +57,6 @@ qse_long_t qse_awk_strxtolong (
|
||||
/*while (QSE_AWK_ISSPACE(awk,*p)) p++;*/
|
||||
|
||||
/* check for a sign */
|
||||
/*while (*p != QSE_T('\0')) */
|
||||
while (p < end)
|
||||
{
|
||||
if (*p == QSE_T('-'))
|
||||
@ -102,7 +101,6 @@ qse_long_t qse_awk_strxtolong (
|
||||
}
|
||||
|
||||
/* process the digits */
|
||||
/*while (*p != QSE_T('\0'))*/
|
||||
while (p < end)
|
||||
{
|
||||
if (*p >= QSE_T('0') && *p <= QSE_T('9'))
|
||||
|
@ -1,3 +1,34 @@
|
||||
BEGIN { FS = "\t"; }
|
||||
|
||||
{ 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];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ function qsort(A, left, right, i, last) {
|
||||
last = left
|
||||
for (i = left+1; i <= right; i++)
|
||||
{
|
||||
# print A[i] "/" A[left] "....." (A[i] < A[left])
|
||||
if (A[i] < A[left])
|
||||
{
|
||||
swap(A, ++last, i)
|
||||
|
1861
qse/regress/awk/regress.out
Normal file
1861
qse/regress/awk/regress.out
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,22 +2,34 @@
|
||||
|
||||
echo_so()
|
||||
{
|
||||
echo "--------------------------------------------------------------------------------"
|
||||
#tput smso
|
||||
tput smso
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
echo -n "$1 "
|
||||
shift
|
||||
done
|
||||
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 "--------------------------------------------------------------------------------"
|
||||
}
|
||||
|
||||
print_usage()
|
||||
{
|
||||
echo "Usage: $0 init"
|
||||
echo " $0 test"
|
||||
echo_so "Usage: $0 init"
|
||||
echo_so " $0 test"
|
||||
}
|
||||
|
||||
###################
|
||||
@ -26,6 +38,7 @@ print_usage()
|
||||
|
||||
QSEAWK=${QSEAWK:=../../cmd/awk/qseawk}
|
||||
TMPFILE="${TMPFILE:=./regress.temp}"
|
||||
OUTFILE="${OUTFILE:=./regress.out}"
|
||||
|
||||
PROGS="
|
||||
cou-001.awk/cou.dat//
|
||||
@ -137,31 +150,54 @@ PROGS="
|
||||
exit 1;
|
||||
}
|
||||
|
||||
echo "${PROGS}" > "${TMPFILE}"
|
||||
run_scripts()
|
||||
{
|
||||
echo "${PROGS}" > "${TMPFILE}"
|
||||
|
||||
while read prog
|
||||
do
|
||||
[ -z "${prog}" ] && continue
|
||||
|
||||
script="`echo ${prog} | cut -d/ -f1`"
|
||||
datafile="`echo ${prog} | cut -d/ -f2`"
|
||||
redinfile="`echo ${prog} | cut -d/ -f3`"
|
||||
awkopts="`echo ${prog} | cut -d/ -f4`"
|
||||
|
||||
[ -z "${script}" ] && continue
|
||||
[ -f "${script}" ] ||
|
||||
{
|
||||
echo_so "${script} not found"
|
||||
continue
|
||||
}
|
||||
|
||||
[ -z "${redinfile}" ] && redinfile="/dev/stdin"
|
||||
|
||||
echo_title "${QSEAWK} ${awkopts} -f ${script} ${datafile} <${redinfile} 2>&1"
|
||||
${QSEAWK} ${awkopts} -f ${script} ${datafile} <${redinfile} 2>&1
|
||||
|
||||
done < "${TMPFILE}"
|
||||
|
||||
rm -f "${TMPFILE}"
|
||||
}
|
||||
|
||||
while read prog
|
||||
do
|
||||
[ -z "${prog}" ] && continue
|
||||
|
||||
script="`echo ${prog} | cut -d/ -f1`"
|
||||
datafile="`echo ${prog} | cut -d/ -f2`"
|
||||
redinfile="`echo ${prog} | cut -d/ -f3`"
|
||||
awkopts="`echo ${prog} | cut -d/ -f4`"
|
||||
|
||||
[ -z "${script}" ] && continue
|
||||
[ -f "${script}" ] ||
|
||||
{
|
||||
echo_so "${script} not found"
|
||||
continue
|
||||
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
|
||||
}
|
||||
|
||||
[ -z "${redinfile}" ] && redinfile="/dev/stdin"
|
||||
|
||||
echo_so "${QSEAWK} ${awkopts} -f ${script} ${datafile} <${redinfile} 2>&1"
|
||||
${QSEAWK} ${awkopts} -f ${script} ${datafile} <${redinfile} 2>&1
|
||||
|
||||
done < "${TMPFILE}"
|
||||
|
||||
rm -f "${TMPFILE}"
|
||||
|
||||
rm -f "${OUTFILE}.temp"
|
||||
;;
|
||||
*)
|
||||
echo_so "USAGE: $0 init"
|
||||
echo_so " $0 test"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
for (i = 1; i <= NF; i++) freq[$i]++;
|
||||
}
|
||||
#/[^kkka-bcx-dd-y]|abc|def/
|
||||
|
||||
END {
|
||||
for (word in freq)
|
||||
|
Loading…
Reference in New Issue
Block a user