Deleted Added
full compact
1#!/bin/sh -
2#
3# @(#)run.test 8.7 (Berkeley) 9/16/93
4#
5
6# db regression tests
7main()
8{
9
10DICT=/usr/share/dict/words
11#DICT=/usr/dict/words
12PROG=./dbtest
13TMP1=t1
14TMP2=t2
15TMP3=t3
16
17 if [ $# -eq 0 ]; then
18 for t in 1 2 3 4 5 6 7 8 9 10 11 12 13 20; do
19 test$t
20 done
21 else
22 while [ $# -gt 0 ]
23 do case "$1" in
24 test*)

--- 315 unchanged lines hidden (view full) ---

340test7()
341{
342 echo "Test 7: btree, recno: delete cursor record"
343 echo "abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg" |
344 awk '{
345 for (i = 1; i <= 120; ++i)
346 printf("%05d: input key %d: %s\n", i, i, $0);
347 printf("%05d: input key %d: %s\n", 120, 120, $0);
348 printf("get failed, no such key\n");
349 printf("%05d: input key %d: %s\n", 1, 1, $0);
350 printf("%05d: input key %d: %s\n", 2, 2, $0);
351 exit;
352 }' > $TMP1
353 rm -f $TMP2 $TMP3
354
355 for type in btree recno; do
356 cat $TMP1 |
357 awk '{
358 if (i == 120)
359 exit;
360 printf("p\nk%d\nd%s\n", ++i, $0);
361 }
362 END {
363 printf("fR_NEXT\n");
364 for (i = 1; i <= 120; ++i)
365 printf("s\n");
366 printf("fR_CURSOR\ns\nk120\n");
367 printf("r\nk120\n");
368 printf("fR_NEXT\ns\n");
369 printf("fR_CURSOR\ns\nk1\n");
370 printf("r\nk1\n");
371 printf("fR_FIRST\ns\n");
372 }' > $TMP2
373 $PROG -o $TMP3 recno $TMP2
374 if (cmp -s $TMP1 $TMP3) ; then :
375 else
376 echo "test7: type $type: failed"
377 exit 1
378 fi

--- 8 unchanged lines hidden (view full) ---

387 echo "" |
388 awk 'BEGIN {
389 for (i = 1; i <= 10; ++i) {
390 printf("p\nkkey1\nD/bin/sh\n");
391 printf("p\nkkey2\nD/bin/csh\n");
392 if (i % 8 == 0) {
393 printf("c\nkkey2\nD/bin/csh\n");
394 printf("c\nkkey1\nD/bin/sh\n");
395 printf("e\t%d of 10 (comparison)\r\n", i);
396 } else
397 printf("e\t%d of 10 \r\n", i);
398 printf("r\nkkey1\nr\nkkey2\n");
399 }
400 printf("e\n");
401 printf("eend of test8 run\n");
402 }' > $TMP1
403 $PROG btree $TMP1
404# $PROG hash $TMP1
405 # No explicit test for success.
406}
407
408# Test btree duplicate keys
409test9()

--- 44 unchanged lines hidden (view full) ---

454 for type in btree recno; do
455 cat $TMP1 |
456 awk '{
457 if (i == 10)
458 exit;
459 printf("p\nk%d\nd%s\n", ++i, $0);
460 }
461 END {
462 printf("fR_CURSOR\nr\nk1\n");
463 printf("eR_CURSOR SHOULD HAVE FAILED\n");
464 }' > $TMP2
465 $PROG -o $TMP3 $type $TMP2 > /dev/null 2>&1
466 if [ -s $TMP3 ] ; then
467 echo "Test 10: delete: R_CURSOR SHOULD HAVE FAILED"
468 exit 1
469 fi
470 done

--- 97 unchanged lines hidden (view full) ---

568 else
569 echo "test13: $type/$order put failed"
570 exit 1
571 fi
572 for i in `sed 50q $DICT`; do
573 echo g
574 echo k$i
575 done > $TMP2
576 $PROG -ilorder=$order -f byte.file -o $TMP3 $type $TMP2
577 if (cmp -s $TMP1 $TMP3) ; then :
578 else
579 echo "test13: $type/$order get failed"
580 exit 1
581 fi
582 done
583 done
584 rm -f byte.file

--- 115 unchanged lines hidden ---