From b96d5d93f40e965959be1e6bf60f903c4103013c Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 19 Nov 2006 07:45:46 +0000 Subject: [PATCH] *** empty log message *** --- ase/test/awk/awk.c | 16 +--------- ase/test/awk/emp-001.out | 8 +++++ ase/test/awk/emp-002.out | 6 ++++ ase/test/awk/emp-003.out | 10 ++++++ ase/test/awk/emp-004.out | 10 ++++++ ase/test/awk/emp-005.out | 10 ++++++ ase/test/awk/emp-006.out | 10 ++++++ ase/test/awk/emp-007.out | 10 ++++++ ase/test/awk/emp-008.out | 4 +++ ase/test/awk/emp-009.out | 7 +++++ ase/test/awk/emp-010.out | 3 ++ ase/test/awk/emp-011.out | 3 ++ ase/test/awk/emp-012.out | 7 +++++ ase/test/awk/emp-013.out | 11 +++++++ ase/test/awk/emp-014.out | 7 +++++ ase/test/awk/emp-015.out | 20 ++++++++++++ ase/test/awk/emp-016.out | 17 +++++++++++ ase/test/awk/emp-017.out | 8 +++++ ase/test/awk/emp-018.out | 4 +++ ase/test/awk/emp-019.out | 12 ++++++++ ase/test/awk/emp-020.out | 9 ++++++ ase/test/awk/emp-021.out | 8 +++++ ase/test/awk/emp-022.out | 8 +++++ ase/test/awk/emp-023.out | 10 ++++++ ase/test/awk/emp-024.out | 9 ++++++ ase/test/awk/emp-025.out | 12 ++++++++ ase/test/awk/emp-026.out | 18 +++++++++++ ase/test/awk/emp-027.out | 15 +++++++++ ase/test/awk/regress.sh | 66 +++++++++++++++++++++++++++++++--------- 29 files changed, 308 insertions(+), 30 deletions(-) create mode 100644 ase/test/awk/emp-001.out create mode 100644 ase/test/awk/emp-002.out create mode 100644 ase/test/awk/emp-003.out create mode 100644 ase/test/awk/emp-004.out create mode 100644 ase/test/awk/emp-005.out create mode 100644 ase/test/awk/emp-006.out create mode 100644 ase/test/awk/emp-007.out create mode 100644 ase/test/awk/emp-008.out create mode 100644 ase/test/awk/emp-009.out create mode 100644 ase/test/awk/emp-010.out create mode 100644 ase/test/awk/emp-011.out create mode 100644 ase/test/awk/emp-012.out create mode 100644 ase/test/awk/emp-013.out create mode 100644 ase/test/awk/emp-014.out create mode 100644 ase/test/awk/emp-015.out create mode 100644 ase/test/awk/emp-016.out create mode 100644 ase/test/awk/emp-017.out create mode 100644 ase/test/awk/emp-018.out create mode 100644 ase/test/awk/emp-019.out create mode 100644 ase/test/awk/emp-020.out create mode 100644 ase/test/awk/emp-021.out create mode 100644 ase/test/awk/emp-022.out create mode 100644 ase/test/awk/emp-023.out create mode 100644 ase/test/awk/emp-024.out create mode 100644 ase/test/awk/emp-025.out create mode 100644 ase/test/awk/emp-026.out create mode 100644 ase/test/awk/emp-027.out diff --git a/ase/test/awk/awk.c b/ase/test/awk/awk.c index d2ba139c..721149b8 100644 --- a/ase/test/awk/awk.c +++ b/ase/test/awk/awk.c @@ -1,5 +1,5 @@ /* - * $Id: awk.c,v 1.116 2006-11-18 15:36:57 bacon Exp $ + * $Id: awk.c,v 1.117 2006-11-19 07:45:46 bacon Exp $ */ #include @@ -17,31 +17,17 @@ #if defined(_WIN32) #include #include - #include #include - #ifndef PATH_MAX - #define ASE_PATH_MAX 4096 - #else - #define ASE_PATH_MAX PATH_MAX - #endif - #define xp_printf _tprintf #define xp_assert assert #pragma warning (disable: 4996) #elif defined(__MSDOS__) - #include #include #include #include - #ifndef PATH_MAX - #define ASE_PATH_MAX 4096 - #else - #define ASE_PATH_MAX PATH_MAX - #endif - #define xp_printf printf #define xp_assert assert #else diff --git a/ase/test/awk/emp-001.out b/ase/test/awk/emp-001.out new file mode 100644 index 00000000..9d894bb6 --- /dev/null +++ b/ase/test/awk/emp-001.out @@ -0,0 +1,8 @@ +($3 > 0) { + print $1,($2 * $3); +} + +Kathy 40 +Mark 100 +Mary 121 +Susie 76.5 diff --git a/ase/test/awk/emp-002.out b/ase/test/awk/emp-002.out new file mode 100644 index 00000000..8f669f7e --- /dev/null +++ b/ase/test/awk/emp-002.out @@ -0,0 +1,6 @@ +($3 == 0) { + print $1; +} + +Beth +Dan diff --git a/ase/test/awk/emp-003.out b/ase/test/awk/emp-003.out new file mode 100644 index 00000000..1762f1f8 --- /dev/null +++ b/ase/test/awk/emp-003.out @@ -0,0 +1,10 @@ +{ + print __global9,$1,$__global9; +} + +3 Beth 0 +3 Dan 0 +3 Kathy 10 +3 Mark 20 +3 Mary 22 +3 Susie 18 diff --git a/ase/test/awk/emp-004.out b/ase/test/awk/emp-004.out new file mode 100644 index 00000000..51598ab9 --- /dev/null +++ b/ase/test/awk/emp-004.out @@ -0,0 +1,10 @@ +{ + print __global10,$0; +} + +1 Beth 4.00 0 +2 Dan 3.74 0 +3 Kathy 4.00 10 +4 Mark 5.00 20 +5 Mary 5.50 22 +6 Susie 4.25 18 diff --git a/ase/test/awk/emp-005.out b/ase/test/awk/emp-005.out new file mode 100644 index 00000000..fc0c9e81 --- /dev/null +++ b/ase/test/awk/emp-005.out @@ -0,0 +1,10 @@ +{ + print "total pay for",$1,"is",($2 * $3); +} + +total pay for Beth is 0 +total pay for Dan is 0 +total pay for Kathy is 40 +total pay for Mark is 100 +total pay for Mary is 121 +total pay for Susie is 76.5 diff --git a/ase/test/awk/emp-006.out b/ase/test/awk/emp-006.out new file mode 100644 index 00000000..3ba88ebb --- /dev/null +++ b/ase/test/awk/emp-006.out @@ -0,0 +1,10 @@ +{ + printf ("total pay for %s is $%.2f\n",$1,($2 * $3)); +} + +total pay for Beth is $0.00 +total pay for Dan is $0.00 +total pay for Kathy is $40.00 +total pay for Mark is $100.00 +total pay for Mary is $121.00 +total pay for Susie is $76.50 diff --git a/ase/test/awk/emp-007.out b/ase/test/awk/emp-007.out new file mode 100644 index 00000000..b0603f79 --- /dev/null +++ b/ase/test/awk/emp-007.out @@ -0,0 +1,10 @@ +{ + printf ("%-8s $%6.2f\n",$1,($2 * $3)); +} + +Beth $ 0.00 +Dan $ 0.00 +Kathy $ 40.00 +Mark $100.00 +Mary $121.00 +Susie $ 76.50 diff --git a/ase/test/awk/emp-008.out b/ase/test/awk/emp-008.out new file mode 100644 index 00000000..019e78b7 --- /dev/null +++ b/ase/test/awk/emp-008.out @@ -0,0 +1,4 @@ +($2 >= 5) + +Mark 5.00 20 +Mary 5.50 22 diff --git a/ase/test/awk/emp-009.out b/ase/test/awk/emp-009.out new file mode 100644 index 00000000..76deb332 --- /dev/null +++ b/ase/test/awk/emp-009.out @@ -0,0 +1,7 @@ +(($2 * $3) > 50) { + printf ("$%.2f for %s\n",($2 * $3),$1); +} + +$100.00 for Mark +$121.00 for Mary +$76.50 for Susie diff --git a/ase/test/awk/emp-010.out b/ase/test/awk/emp-010.out new file mode 100644 index 00000000..eaa876ae --- /dev/null +++ b/ase/test/awk/emp-010.out @@ -0,0 +1,3 @@ +($1 == "Susie") + +Susie 4.25 18 diff --git a/ase/test/awk/emp-011.out b/ase/test/awk/emp-011.out new file mode 100644 index 00000000..c0d44782 --- /dev/null +++ b/ase/test/awk/emp-011.out @@ -0,0 +1,3 @@ +/Susie/ + +Susie 4.25 18 diff --git a/ase/test/awk/emp-012.out b/ase/test/awk/emp-012.out new file mode 100644 index 00000000..73946169 --- /dev/null +++ b/ase/test/awk/emp-012.out @@ -0,0 +1,7 @@ +(($2 >= 4) || ($3 >= 20)) + +Beth 4.00 0 +Kathy 4.00 10 +Mark 5.00 20 +Mary 5.50 22 +Susie 4.25 18 diff --git a/ase/test/awk/emp-013.out b/ase/test/awk/emp-013.out new file mode 100644 index 00000000..0b69688a --- /dev/null +++ b/ase/test/awk/emp-013.out @@ -0,0 +1,11 @@ +($2 >= 4) + +($3 >= 20) + +Beth 4.00 0 +Kathy 4.00 10 +Mark 5.00 20 +Mark 5.00 20 +Mary 5.50 22 +Mary 5.50 22 +Susie 4.25 18 diff --git a/ase/test/awk/emp-014.out b/ase/test/awk/emp-014.out new file mode 100644 index 00000000..cde00a5a --- /dev/null +++ b/ase/test/awk/emp-014.out @@ -0,0 +1,7 @@ +(!((($2 < 4) && ($3 < 20)))) + +Beth 4.00 0 +Kathy 4.00 10 +Mark 5.00 20 +Mary 5.50 22 +Susie 4.25 18 diff --git a/ase/test/awk/emp-015.out b/ase/test/awk/emp-015.out new file mode 100644 index 00000000..3ce88d2b --- /dev/null +++ b/ase/test/awk/emp-015.out @@ -0,0 +1,20 @@ +(__global9 != 3) { + print $0,"number of fields is not equal to 3"; +} + +($2 < 3.35) { + print $0,"rate is below minimum wage"; +} + +($2 > 10) { + print $0,"rate exceeds $10 per hour"; +} + +($3 < 0) { + print $0,"negative hours worked"; +} + +($3 > 60) { + print $0,"too many hours worked"; +} + diff --git a/ase/test/awk/emp-016.out b/ase/test/awk/emp-016.out new file mode 100644 index 00000000..46f95c08 --- /dev/null +++ b/ase/test/awk/emp-016.out @@ -0,0 +1,17 @@ +BEGIN { + print "NAME RATE HOURS"; + print ""; +} + +{ + print; +} + +NAME RATE HOURS + +Beth 4.00 0 +Dan 3.74 0 +Kathy 4.00 10 +Mark 5.00 20 +Mary 5.50 22 +Susie 4.25 18 diff --git a/ase/test/awk/emp-017.out b/ase/test/awk/emp-017.out new file mode 100644 index 00000000..e7e5ac24 --- /dev/null +++ b/ase/test/awk/emp-017.out @@ -0,0 +1,8 @@ +($3 > 15) { + emp = (emp + 1); +} + +END { + print emp,"employees worked more than 15 hours"; +} +3 employees worked more than 15 hours diff --git a/ase/test/awk/emp-018.out b/ase/test/awk/emp-018.out new file mode 100644 index 00000000..909843f2 --- /dev/null +++ b/ase/test/awk/emp-018.out @@ -0,0 +1,4 @@ +END { + print __global10,"employees"; +} +6 employees diff --git a/ase/test/awk/emp-019.out b/ase/test/awk/emp-019.out new file mode 100644 index 00000000..f7512eb1 --- /dev/null +++ b/ase/test/awk/emp-019.out @@ -0,0 +1,12 @@ +{ + pay = (pay + ($2 * $3)); +} + +END { + print __global10,"employees"; + print "total pay is",pay; + print "average pay is",(pay / __global10); +} +6 employees +total pay is 337.5 +average pay is 56.25 diff --git a/ase/test/awk/emp-020.out b/ase/test/awk/emp-020.out new file mode 100644 index 00000000..5f2a54f3 --- /dev/null +++ b/ase/test/awk/emp-020.out @@ -0,0 +1,9 @@ +($2 > maxrate) { + maxrate = $2; + maxemp = $1; +} + +END { + print "highest hourly rage:",maxrate,"for",maxemp; +} +highest hourly rage: 5.50 for Mary diff --git a/ase/test/awk/emp-021.out b/ase/test/awk/emp-021.out new file mode 100644 index 00000000..676a8bdc --- /dev/null +++ b/ase/test/awk/emp-021.out @@ -0,0 +1,8 @@ +{ + names = ((names $1) " "); +} + +END { + print names; +} +Beth Dan Kathy Mark Mary Susie diff --git a/ase/test/awk/emp-022.out b/ase/test/awk/emp-022.out new file mode 100644 index 00000000..9e0bc46c --- /dev/null +++ b/ase/test/awk/emp-022.out @@ -0,0 +1,8 @@ +{ + last = $0; +} + +END { + print last; +} +Susie 4.25 18 diff --git a/ase/test/awk/emp-023.out b/ase/test/awk/emp-023.out new file mode 100644 index 00000000..0852ccaa --- /dev/null +++ b/ase/test/awk/emp-023.out @@ -0,0 +1,10 @@ +{ + print $1,length ($1); +} + +Beth 4 +Dan 3 +Kathy 5 +Mark 4 +Mary 4 +Susie 5 diff --git a/ase/test/awk/emp-024.out b/ase/test/awk/emp-024.out new file mode 100644 index 00000000..27f914bc --- /dev/null +++ b/ase/test/awk/emp-024.out @@ -0,0 +1,9 @@ +{ + nc = ((nc + length ($0)) + 1); + nw = (nw + __global9); +} + +END { + print __global10,"lines,",nw,"words,",nc,"characters"; +} +6 lines, 18 words, 77 characters diff --git a/ase/test/awk/emp-025.out b/ase/test/awk/emp-025.out new file mode 100644 index 00000000..69b10629 --- /dev/null +++ b/ase/test/awk/emp-025.out @@ -0,0 +1,12 @@ +($2 > 6) { + n = (n + 1); + pay = (pay + ($2 * $3)); +} + +END { + if ((n > 0)) + print n,"employees, total pay is",pay,"average pay is",(pay / n); + else + print "no employees are paid more than $6/hour"; +} +no employees are paid more than $6/hour diff --git a/ase/test/awk/emp-026.out b/ase/test/awk/emp-026.out new file mode 100644 index 00000000..f3bcb78e --- /dev/null +++ b/ase/test/awk/emp-026.out @@ -0,0 +1,18 @@ +{ + line[__global10] = $0; +} + +END { + i = __global10; + while ((i > 0)) + { + print line[i]; + i = (i - 1); + } +} +Susie 4.25 18 +Mary 5.50 22 +Mark 5.00 20 +Kathy 4.00 10 +Dan 3.74 0 +Beth 4.00 0 diff --git a/ase/test/awk/emp-027.out b/ase/test/awk/emp-027.out new file mode 100644 index 00000000..85acdc22 --- /dev/null +++ b/ase/test/awk/emp-027.out @@ -0,0 +1,15 @@ +{ + line[__global10] = $0; +} + +END { + i = __global10; + for (i = __global10; (i > 0); i = (i - 1)) + print line[i]; +} +Susie 4.25 18 +Mary 5.50 22 +Mark 5.00 20 +Kathy 4.00 10 +Dan 3.74 0 +Beth 4.00 0 diff --git a/ase/test/awk/regress.sh b/ase/test/awk/regress.sh index 2520aad0..10711970 100755 --- a/ase/test/awk/regress.sh +++ b/ase/test/awk/regress.sh @@ -1,21 +1,57 @@ #!/bin/sh -pid=$$ +init() +{ + for script in emp-???.awk + do + output=`echo $script | sed 's/\.awk$/.out/g'` + ./awk $script emp-en.data > "$output" + done +} -for script in emp???.awk -do - output=`echo $script | sed 's/\.awk$/.out/g'` - ./awk $script emp-en.data > "$output.$pid" +test() +{ + pid=$$ + + for script in emp-???.awk + do + output=`echo $script | sed 's/\.awk$/.out/g'` + ./awk $script emp-en.data > "$output.$pid" + + diff $output "$output.$pid" + if [ $? -ne 0 ] + then + echo "###################################" + echo "PROBLEM(S) DETECTED IN $script.". + echo "###################################" + rm -f "$output.$pid" + break + fi - diff $output "$output.$pid" - if [ $? -ne 0 ] - then - echo "###################################" - echo "PROBLEM(S) DETECTED IN $script.". - echo "###################################" rm -f "$output.$pid" - break - fi + done +} + +#--------# +# main # +#--------# + +if [ $# -ne 1 ] +then + echo "Usage: $0 init" + echo " $0 test" + exit 1 +fi + +if [ "$1" = "init" ] +then + init +elif [ "$1" = "test" ] +then + test +else + echo "Usage: $0 init" + echo " $0 test" + exit 1 +fi - rm -f "$output.$pid" -done