From 39e6f0d5ee185d539e2aa6156c964aaab6d54aab Mon Sep 17 00:00:00 2001 From: gdr Date: Wed, 17 Sep 1997 06:31:15 +0000 Subject: [PATCH] - initial checkin, as submitted by Dave Tribby --- bin/wc/tests/dotests | 99 ++++++++ bin/wc/tests/f500.c | 1 + bin/wc/tests/f500.clw | 1 + bin/wc/tests/f500.clwB | 1 + bin/wc/tests/f500.l | 1 + bin/wc/tests/f500.w | 1 + bin/wc/tests/file500.txt | 500 +++++++++++++++++++++++++++++++++++++++ bin/wc/tests/fulltests | 28 +++ bin/wc/tests/multi.clw | 7 + bin/wc/tests/test.list | 58 +++++ 10 files changed, 697 insertions(+) create mode 100644 bin/wc/tests/dotests create mode 100644 bin/wc/tests/f500.c create mode 100644 bin/wc/tests/f500.clw create mode 100644 bin/wc/tests/f500.clwB create mode 100644 bin/wc/tests/f500.l create mode 100644 bin/wc/tests/f500.w create mode 100644 bin/wc/tests/file500.txt create mode 100644 bin/wc/tests/fulltests create mode 100644 bin/wc/tests/multi.clw create mode 100644 bin/wc/tests/test.list diff --git a/bin/wc/tests/dotests b/bin/wc/tests/dotests new file mode 100644 index 0000000..d3eee3b --- /dev/null +++ b/bin/wc/tests/dotests @@ -0,0 +1,99 @@ +# Tests for wc command; invoked by command file "fulltests" +# Written by Dave Tribby (August 1997) + +# Location of the wc command to be tested +set testcmd="../wc" + +# Record starting time +echo -n "Testing command $testcmd beginning at" +date + +set src="file500.txt" +set cmp="f500.clw" +set dest="/tmp/$cmp" +echo "Counting bytes, lines, and words (default) of $src" +$testcmd $src > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + +set dest="/tmp/${cmp}A" +echo "Counting bytes, lines, and words (explicit) of $src" +$testcmd -clw $src > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + +set cmp="${cmp}B" +set dest="/tmp/$cmp" +echo "Counting bytes, lines, and words (default) of $src using stdin" +$testcmd < $src > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + + +set cmp="f500.c" +set dest="/tmp/$cmp" +echo "Counting bytes of $src" +$testcmd -c $src > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + + +set cmp="f500.l" +set dest="/tmp/$cmp" +echo "Counting lines of $src" +$testcmd -l $src > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + + +set cmp="f500.w" +set dest="/tmp/$cmp" +echo "Counting words of $src" +$testcmd -w $src > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + + +set cmp="multi.clw" +set dest="/tmp/$cmp" +echo "Counting bytes, lines, and words (default) of f*.*" +$testcmd f*.* > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + + +echo "***** Error Messages *****" + +set dest="/tmp/err.cond" + +echo "" +echo "Expected error: illegal option" +$testcmd -x $src > $dest +echo " Error completion status = $status (expected: 1)" + +echo "" +set src="badname" +echo "Expected error: $src: no such file or directory" +$testcmd $src > $dest +echo " Error completion status = $status (expected: 1)" diff --git a/bin/wc/tests/f500.c b/bin/wc/tests/f500.c new file mode 100644 index 0000000..da523cb --- /dev/null +++ b/bin/wc/tests/f500.c @@ -0,0 +1 @@ + 12500 file500.txt diff --git a/bin/wc/tests/f500.clw b/bin/wc/tests/f500.clw new file mode 100644 index 0000000..a72bbe6 --- /dev/null +++ b/bin/wc/tests/f500.clw @@ -0,0 +1 @@ + 500 2500 12500 file500.txt diff --git a/bin/wc/tests/f500.clwB b/bin/wc/tests/f500.clwB new file mode 100644 index 0000000..a167716 --- /dev/null +++ b/bin/wc/tests/f500.clwB @@ -0,0 +1 @@ + 500 2500 12500 diff --git a/bin/wc/tests/f500.l b/bin/wc/tests/f500.l new file mode 100644 index 0000000..40a8dae --- /dev/null +++ b/bin/wc/tests/f500.l @@ -0,0 +1 @@ + 500 file500.txt diff --git a/bin/wc/tests/f500.w b/bin/wc/tests/f500.w new file mode 100644 index 0000000..3e3a7c0 --- /dev/null +++ b/bin/wc/tests/f500.w @@ -0,0 +1 @@ + 2500 file500.txt diff --git a/bin/wc/tests/file500.txt b/bin/wc/tests/file500.txt new file mode 100644 index 0000000..cab2c21 --- /dev/null +++ b/bin/wc/tests/file500.txt @@ -0,0 +1,500 @@ +This is line number 1 +This is line number 2 +This is line number 3 +This is line number 4 +This is line number 5 +This is line number 6 +This is line number 7 +This is line number 8 +This is line number 9 +This is line number 10 +This is line number 11 +This is line number 12 +This is line number 13 +This is line number 14 +This is line number 15 +This is line number 16 +This is line number 17 +This is line number 18 +This is line number 19 +This is line number 20 +This is line number 21 +This is line number 22 +This is line number 23 +This is line number 24 +This is line number 25 +This is line number 26 +This is line number 27 +This is line number 28 +This is line number 29 +This is line number 30 +This is line number 31 +This is line number 32 +This is line number 33 +This is line number 34 +This is line number 35 +This is line number 36 +This is line number 37 +This is line number 38 +This is line number 39 +This is line number 40 +This is line number 41 +This is line number 42 +This is line number 43 +This is line number 44 +This is line number 45 +This is line number 46 +This is line number 47 +This is line number 48 +This is line number 49 +This is line number 50 +This is line number 51 +This is line number 52 +This is line number 53 +This is line number 54 +This is line number 55 +This is line number 56 +This is line number 57 +This is line number 58 +This is line number 59 +This is line number 60 +This is line number 61 +This is line number 62 +This is line number 63 +This is line number 64 +This is line number 65 +This is line number 66 +This is line number 67 +This is line number 68 +This is line number 69 +This is line number 70 +This is line number 71 +This is line number 72 +This is line number 73 +This is line number 74 +This is line number 75 +This is line number 76 +This is line number 77 +This is line number 78 +This is line number 79 +This is line number 80 +This is line number 81 +This is line number 82 +This is line number 83 +This is line number 84 +This is line number 85 +This is line number 86 +This is line number 87 +This is line number 88 +This is line number 89 +This is line number 90 +This is line number 91 +This is line number 92 +This is line number 93 +This is line number 94 +This is line number 95 +This is line number 96 +This is line number 97 +This is line number 98 +This is line number 99 +This is line number 100 +This is line number 101 +This is line number 102 +This is line number 103 +This is line number 104 +This is line number 105 +This is line number 106 +This is line number 107 +This is line number 108 +This is line number 109 +This is line number 110 +This is line number 111 +This is line number 112 +This is line number 113 +This is line number 114 +This is line number 115 +This is line number 116 +This is line number 117 +This is line number 118 +This is line number 119 +This is line number 120 +This is line number 121 +This is line number 122 +This is line number 123 +This is line number 124 +This is line number 125 +This is line number 126 +This is line number 127 +This is line number 128 +This is line number 129 +This is line number 130 +This is line number 131 +This is line number 132 +This is line number 133 +This is line number 134 +This is line number 135 +This is line number 136 +This is line number 137 +This is line number 138 +This is line number 139 +This is line number 140 +This is line number 141 +This is line number 142 +This is line number 143 +This is line number 144 +This is line number 145 +This is line number 146 +This is line number 147 +This is line number 148 +This is line number 149 +This is line number 150 +This is line number 151 +This is line number 152 +This is line number 153 +This is line number 154 +This is line number 155 +This is line number 156 +This is line number 157 +This is line number 158 +This is line number 159 +This is line number 160 +This is line number 161 +This is line number 162 +This is line number 163 +This is line number 164 +This is line number 165 +This is line number 166 +This is line number 167 +This is line number 168 +This is line number 169 +This is line number 170 +This is line number 171 +This is line number 172 +This is line number 173 +This is line number 174 +This is line number 175 +This is line number 176 +This is line number 177 +This is line number 178 +This is line number 179 +This is line number 180 +This is line number 181 +This is line number 182 +This is line number 183 +This is line number 184 +This is line number 185 +This is line number 186 +This is line number 187 +This is line number 188 +This is line number 189 +This is line number 190 +This is line number 191 +This is line number 192 +This is line number 193 +This is line number 194 +This is line number 195 +This is line number 196 +This is line number 197 +This is line number 198 +This is line number 199 +This is line number 200 +This is line number 201 +This is line number 202 +This is line number 203 +This is line number 204 +This is line number 205 +This is line number 206 +This is line number 207 +This is line number 208 +This is line number 209 +This is line number 210 +This is line number 211 +This is line number 212 +This is line number 213 +This is line number 214 +This is line number 215 +This is line number 216 +This is line number 217 +This is line number 218 +This is line number 219 +This is line number 220 +This is line number 221 +This is line number 222 +This is line number 223 +This is line number 224 +This is line number 225 +This is line number 226 +This is line number 227 +This is line number 228 +This is line number 229 +This is line number 230 +This is line number 231 +This is line number 232 +This is line number 233 +This is line number 234 +This is line number 235 +This is line number 236 +This is line number 237 +This is line number 238 +This is line number 239 +This is line number 240 +This is line number 241 +This is line number 242 +This is line number 243 +This is line number 244 +This is line number 245 +This is line number 246 +This is line number 247 +This is line number 248 +This is line number 249 +This is line number 250 +This is line number 251 +This is line number 252 +This is line number 253 +This is line number 254 +This is line number 255 +This is line number 256 +This is line number 257 +This is line number 258 +This is line number 259 +This is line number 260 +This is line number 261 +This is line number 262 +This is line number 263 +This is line number 264 +This is line number 265 +This is line number 266 +This is line number 267 +This is line number 268 +This is line number 269 +This is line number 270 +This is line number 271 +This is line number 272 +This is line number 273 +This is line number 274 +This is line number 275 +This is line number 276 +This is line number 277 +This is line number 278 +This is line number 279 +This is line number 280 +This is line number 281 +This is line number 282 +This is line number 283 +This is line number 284 +This is line number 285 +This is line number 286 +This is line number 287 +This is line number 288 +This is line number 289 +This is line number 290 +This is line number 291 +This is line number 292 +This is line number 293 +This is line number 294 +This is line number 295 +This is line number 296 +This is line number 297 +This is line number 298 +This is line number 299 +This is line number 300 +This is line number 301 +This is line number 302 +This is line number 303 +This is line number 304 +This is line number 305 +This is line number 306 +This is line number 307 +This is line number 308 +This is line number 309 +This is line number 310 +This is line number 311 +This is line number 312 +This is line number 313 +This is line number 314 +This is line number 315 +This is line number 316 +This is line number 317 +This is line number 318 +This is line number 319 +This is line number 320 +This is line number 321 +This is line number 322 +This is line number 323 +This is line number 324 +This is line number 325 +This is line number 326 +This is line number 327 +This is line number 328 +This is line number 329 +This is line number 330 +This is line number 331 +This is line number 332 +This is line number 333 +This is line number 334 +This is line number 335 +This is line number 336 +This is line number 337 +This is line number 338 +This is line number 339 +This is line number 340 +This is line number 341 +This is line number 342 +This is line number 343 +This is line number 344 +This is line number 345 +This is line number 346 +This is line number 347 +This is line number 348 +This is line number 349 +This is line number 350 +This is line number 351 +This is line number 352 +This is line number 353 +This is line number 354 +This is line number 355 +This is line number 356 +This is line number 357 +This is line number 358 +This is line number 359 +This is line number 360 +This is line number 361 +This is line number 362 +This is line number 363 +This is line number 364 +This is line number 365 +This is line number 366 +This is line number 367 +This is line number 368 +This is line number 369 +This is line number 370 +This is line number 371 +This is line number 372 +This is line number 373 +This is line number 374 +This is line number 375 +This is line number 376 +This is line number 377 +This is line number 378 +This is line number 379 +This is line number 380 +This is line number 381 +This is line number 382 +This is line number 383 +This is line number 384 +This is line number 385 +This is line number 386 +This is line number 387 +This is line number 388 +This is line number 389 +This is line number 390 +This is line number 391 +This is line number 392 +This is line number 393 +This is line number 394 +This is line number 395 +This is line number 396 +This is line number 397 +This is line number 398 +This is line number 399 +This is line number 400 +This is line number 401 +This is line number 402 +This is line number 403 +This is line number 404 +This is line number 405 +This is line number 406 +This is line number 407 +This is line number 408 +This is line number 409 +This is line number 410 +This is line number 411 +This is line number 412 +This is line number 413 +This is line number 414 +This is line number 415 +This is line number 416 +This is line number 417 +This is line number 418 +This is line number 419 +This is line number 420 +This is line number 421 +This is line number 422 +This is line number 423 +This is line number 424 +This is line number 425 +This is line number 426 +This is line number 427 +This is line number 428 +This is line number 429 +This is line number 430 +This is line number 431 +This is line number 432 +This is line number 433 +This is line number 434 +This is line number 435 +This is line number 436 +This is line number 437 +This is line number 438 +This is line number 439 +This is line number 440 +This is line number 441 +This is line number 442 +This is line number 443 +This is line number 444 +This is line number 445 +This is line number 446 +This is line number 447 +This is line number 448 +This is line number 449 +This is line number 450 +This is line number 451 +This is line number 452 +This is line number 453 +This is line number 454 +This is line number 455 +This is line number 456 +This is line number 457 +This is line number 458 +This is line number 459 +This is line number 460 +This is line number 461 +This is line number 462 +This is line number 463 +This is line number 464 +This is line number 465 +This is line number 466 +This is line number 467 +This is line number 468 +This is line number 469 +This is line number 470 +This is line number 471 +This is line number 472 +This is line number 473 +This is line number 474 +This is line number 475 +This is line number 476 +This is line number 477 +This is line number 478 +This is line number 479 +This is line number 480 +This is line number 481 +This is line number 482 +This is line number 483 +This is line number 484 +This is line number 485 +This is line number 486 +This is line number 487 +This is line number 488 +This is line number 489 +This is line number 490 +This is line number 491 +This is line number 492 +This is line number 493 +This is line number 494 +This is line number 495 +This is line number 496 +This is line number 497 +This is line number 498 +This is line number 499 +This is line number 500 diff --git a/bin/wc/tests/fulltests b/bin/wc/tests/fulltests new file mode 100644 index 0000000..0eea615 --- /dev/null +++ b/bin/wc/tests/fulltests @@ -0,0 +1,28 @@ +# gsh script to run tests and collect results +# Written by Dave Tribby * August 1997 + +# Name of gsh script containing test cases +set command="dotests" +# Sometimes the file type is modified by editing; make it executable +chtyp -l exec $command + +# Filenames for raw and modified results +set raw_file="/tmp/rawlist" +set result_file="test.list" + +# Location of tr command that knows how to handle classes +set trcmd="/src/usr.bin/tr/tr" + +# --- Begin the tests --- + +echo -n "Executing test script \"$command\" from directory " +pwd + +# Create a new gsh invocation and record all I/O +echo "$command ; exit" | script $raw_file + +# Cleanup control chars using either of the following... +echo "Done with tests. Removing control characters from results file" +$trcmd -c -ds '[:print:]\r' '\r' < $raw_file > $result_file + +echo "Tests results have been saved as \"$result_file\"" diff --git a/bin/wc/tests/multi.clw b/bin/wc/tests/multi.clw new file mode 100644 index 0000000..1ed617a --- /dev/null +++ b/bin/wc/tests/multi.clw @@ -0,0 +1,7 @@ + 1 2 21 f500.c + 1 4 37 f500.clw + 1 3 25 f500.clwB + 1 2 21 f500.l + 1 2 21 f500.w + 500 2500 12500 file500.txt + 505 2513 12625 total diff --git a/bin/wc/tests/test.list b/bin/wc/tests/test.list new file mode 100644 index 0000000..901699f --- /dev/null +++ b/bin/wc/tests/test.list @@ -0,0 +1,58 @@ +Script started on: Mon Sep 01 15:07:57 1997 +[61] test=> dotests ; exit +Testing command ../wc beginning at Mon Sep 1 15:08:09 1997 +Counting bytes, lines, and words (default) of file500.txt + ==> 872 stack bytes used <== + Completion status = 0 +Checking results against control file f500.clw (no differences expected) + Completion status = 0 + +Counting bytes, lines, and words (explicit) of file500.txt + ==> 872 stack bytes used <== + Completion status = 0 +Checking results against control file f500.clw (no differences expected) + Completion status = 0 + +Counting bytes, lines, and words (default) of file500.txt using stdin + ==> 872 stack bytes used <== + Completion status = 0 +Checking results against control file f500.clwB (no differences expected) + Completion status = 0 + +Counting bytes of file500.txt + ==> 872 stack bytes used <== + Completion status = 0 +Checking results against control file f500.c (no differences expected) + Completion status = 0 + +Counting lines of file500.txt + ==> 872 stack bytes used <== + Completion status = 0 +Checking results against control file f500.l (no differences expected) + Completion status = 0 + +Counting words of file500.txt + ==> 872 stack bytes used <== + Completion status = 0 +Checking results against control file f500.w (no differences expected) + Completion status = 0 + +Counting bytes, lines, and words (default) of f*.* + ==> 872 stack bytes used <== + Completion status = 0 +Checking results against control file multi.clw (no differences expected) + Completion status = 0 + +***** Error Messages ***** + +Expected error: illegal option +wc: illegal option -- x +usage: wc [-clw] [files] + ==> 1827 stack bytes used <== + Error completion status = 1 (expected: 1) + +Expected error: badname: no such file or directory +wc: badname: open: no such file or directory + ==> 1938 stack bytes used <== + Error completion status = 1 (expected: 1) +Script done on: Mon Sep 01 15:09:13 1997