3 # This script runs the wordcount program in different ways, comparing
4 # the output from each.
7 # Select the source text to be analyzed.
10 then echo "Usage: $0 FILENAME [ARGS...]"; exit 1;
16 .
/wordcount
--timer --summary wcdb1.db $
* --insert >wc-out.txt
17 mv wc-out.txt wc-baseline.txt
19 .
/wordcount
--timer --summary wcdb2.db $
* --insert --without-rowid >wc-out.txt
20 if cmp -s wc-out.txt wc-baseline.txt
;
21 then echo hi
>/dev
/null
;
23 diff -u wc-baseline.txt wc-out.txt
;
27 .
/wordcount
--timer --summary wcdb1.db $
* --replace >wc-out.txt
28 if cmp -s wc-out.txt wc-baseline.txt
;
29 then echo hi
>/dev
/null
;
31 diff -u wc-baseline.txt wc-out.txt
;
34 .
/wordcount
--timer --summary wcdb2.db $
* --replace --without-rowid >wc-out.txt
35 if cmp -s wc-out.txt wc-baseline.txt
;
36 then echo hi
>/dev
/null
;
38 diff -u wc-baseline.txt wc-out.txt
;
42 .
/wordcount
--timer --summary wcdb1.db $
* --select >wc-out.txt
43 if cmp -s wc-out.txt wc-baseline.txt
;
44 then echo hi
>/dev
/null
;
46 diff -u wc-baseline.txt wc-out.txt
;
50 .
/wordcount
--timer --summary wcdb2.db $
* --select --without-rowid >wc-out.txt
51 if cmp -s wc-out.txt wc-baseline.txt
;
52 then echo hi
>/dev
/null
;
54 diff -u wc-baseline.txt wc-out.txt
;
57 .
/wordcount
--timer --summary wcdb1.db $
* --query >wc-out.txt
58 mv wc-out.txt wc-baseline.txt
59 .
/wordcount
--timer --summary wcdb2.db $
* --query --without-rowid >wc-out.txt
60 if cmp -s wc-out.txt wc-baseline.txt
;
61 then echo hi
>/dev
/null
;
63 diff -u wc-baseline.txt wc-out.txt
;
66 .
/wordcount
--timer --summary wcdb1.db $
* --delete >wc-out.txt
67 mv wc-out.txt wc-baseline.txt
68 .
/wordcount
--timer --summary wcdb2.db $
* --delete --without-rowid >wc-out.txt
69 if cmp -s wc-out.txt wc-baseline.txt
;
70 then echo hi
>/dev
/null
;
72 diff -u wc-baseline.txt wc-out.txt
;
76 # Clean up temporary files created.
78 rm -rf wcdb1.db wcdb2.db wc-out.txt wc-baseline.txt