Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aedfc50

Browse files
author
drh
committed
Fully constraint the ORDER BY on the top-10 line of the --summary output
from the wordcount test program. Add the run-wordcount.bash script for running wordcount in various configurations. FossilOrigin-Name: 7edf39eb93a8f9059a788f5fccf41c2be40afd4d
1 parent 64bbbf3 commit aedfc50

File tree

4 files changed

+75
-8
lines changed

4 files changed

+75
-8
lines changed

manifest

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
C Avoid\sunnecessary\sOP_IfNull\schecks\swhen\sdoing\sa\srange\squery\swhere\sthere\nis\sa\sconstraint\son\sthe\slower\sbound\sof\sthe\srange.
2-
D 2013-11-16T14:03:53.332
1+
C Fully\sconstraint\sthe\sORDER\sBY\son\sthe\stop-10\sline\sof\sthe\s--summary\soutput\nfrom\sthe\swordcount\stest\sprogram.\s\sAdd\sthe\srun-wordcount.bash\sscript\sfor\nrunning\swordcount\sin\svarious\sconfigurations.
2+
D 2013-11-16T15:35:18.956
33
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
44
F Makefile.in 8a07bebafbfda0eb67728f4bd15a36201662d1a1
55
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -757,6 +757,7 @@ F test/rollback.test e9504a009a202c3ed711da2e6879ff60c5a4669c
757757
F test/rowhash.test 0bc1d31415e4575d10cacf31e1a66b5cc0f8be81
758758
F test/rowid.test f777404492adb0e00868fd706a3721328fd3af48
759759
F test/rtree.test 0c8d9dd458d6824e59683c19ab2ffa9ef946f798
760+
F test/run-wordcount.bash 1c6a8b75738db8c53e5125be3d81ab63ef9eefd0
760761
F test/savepoint.test 6c53f76dffe5df0dd87646efe3e7aa159c36e07b
761762
F test/savepoint2.test 9b8543940572a2f01a18298c3135ad0c9f4f67d7
762763
F test/savepoint3.test e328085853b14898d78ceea00dfe7db18bb6a9ec
@@ -1087,7 +1088,7 @@ F test/without_rowid1.test aaa26da19d543cd8d3d2d0e686dfa255556c15c8
10871088
F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99
10881089
F test/without_rowid3.test eac3d5c8a1924725b58503a368f2cbd24fd6c8a0
10891090
F test/without_rowid4.test 4e08bcbaee0399f35d58b5581881e7a6243d458a
1090-
F test/wordcount.c b8872ec44e8085bb671048a49cb696bed1100fe3
1091+
F test/wordcount.c c80f378f26fbf6ada602c4313ae88fc47439263e
10911092
F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688
10921093
F test/zerodamage.test 209d7ed441f44cc5299e4ebffbef06fd5aabfefd
10931094
F tool/build-all-msvc.bat 1bac6adc3fdb4d9204f21d17b14be25778370e48 x
@@ -1139,7 +1140,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
11391140
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
11401141
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
11411142
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
1142-
P ee9353fdf3c8f19cd3c344ea8fb7c6d13cadd632
1143-
R bbc3c855c90e1aef97168122cf6d1f16
1143+
P de08a7e7abbad9b94d0268d096ef4555d31c8b0c
1144+
R 172f7957a55e2959255a9b6c3406c731
11441145
U drh
1145-
Z c2c8cf1e135b3375a8bab4d9c0d72dac
1146+
Z e8555787a9b5df5e1de6c7d36654ffb3

manifest.uuid

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
de08a7e7abbad9b94d0268d096ef4555d31c8b0c
1+
7edf39eb93a8f9059a788f5fccf41c2be40afd4d

test/run-wordcount.bash

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/bin/bash
2+
#
3+
# This script runs the wordcount program in different ways, comparing
4+
# the output from each.
5+
#
6+
7+
8+
# Run the wordcount command with argument supplied and with --summary.
9+
# Store the results in wc-out.txt and report the run-time.
10+
#
11+
function time_wordcount {
12+
/usr/bin/time --format='%e %C' ./wordcount --summary $* >wc-out.txt
13+
}
14+
15+
# Compare wc-out.txt against wc-baseline.txt and report any differences.
16+
#
17+
function compare_results {
18+
if cmp -s wc-out.txt wc-baseline.txt;
19+
then echo hi >/dev/null;
20+
else echo ERROR:;
21+
diff -u wc-baseline.txt wc-out.txt;
22+
fi
23+
}
24+
25+
# Select the source text to be analyzed.
26+
#
27+
if test "x$1" = "x";
28+
then echo "Usage: $0 FILENAME [ARGS...]"; exit 1;
29+
fi
30+
31+
# Do test runs
32+
#
33+
rm -f wcdb1.db
34+
time_wordcount wcdb1.db $* --insert
35+
mv wc-out.txt wc-baseline.txt
36+
rm -f wcdb2.db
37+
time_wordcount wcdb2.db $* --insert --without-rowid
38+
compare_results
39+
40+
rm -f wcdb1.db
41+
time_wordcount wcdb1.db $* --replace
42+
compare_results
43+
rm -f wcdb2.db
44+
time_wordcount wcdb2.db $* --replace --without-rowid
45+
compare_results
46+
47+
rm -f wcdb1.db
48+
time_wordcount wcdb1.db $* --select
49+
compare_results
50+
rm -f wcdb2.db
51+
time_wordcount wcdb2.db $* --select --without-rowid
52+
compare_results
53+
54+
time_wordcount wcdb1.db $* --query
55+
mv wc-out.txt wc-baseline.txt
56+
time_wordcount wcdb2.db $* --query --without-rowid
57+
compare_results
58+
59+
time_wordcount wcdb1.db $* --delete
60+
mv wc-out.txt wc-baseline.txt
61+
time_wordcount wcdb2.db $* --delete --without-rowid
62+
compare_results
63+
64+
# Clean up temporary files created.
65+
#
66+
rm -rf wcdb1.db wcdb2.db wc-out.txt wc-baseline.txt

test/wordcount.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ int main(int argc, char **argv){
459459
"SELECT 'avg(cnt): ', avg(cnt) FROM wordcount;\n"
460460
"SELECT 'sum(cnt=1):', sum(cnt=1) FROM wordcount;\n"
461461
"SELECT 'top 10: ', group_concat(word, ', ') FROM "
462-
"(SELECT word FROM wordcount ORDER BY cnt DESC LIMIT 10);\n"
462+
"(SELECT word FROM wordcount ORDER BY cnt DESC, word LIMIT 10);\n"
463463
"SELECT 'checksum: ', checksum(word, cnt) FROM "
464464
"(SELECT word, cnt FROM wordcount ORDER BY word);\n"
465465
"PRAGMA integrity_check;\n",

0 commit comments

Comments
 (0)