3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
12 # Tests for the glob-style string compare operator embedded in the
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
19 catch { unset testnum }
20 catch { unset pattern }
24 foreach {testnum pattern text ans} {
38 16 */abc/* x///a/ab/abc 0
39 17 */abc/* x//a/ab/abc/ 1
40 16 */abc/* x///a/ab/abc 0
41 17 */abc/* x//a/ab/abc/ 1
42 18 **/abc/** x//a/ab/abc/ 1
43 19 *?/abc/*? x//a/ab/abc/y 1
44 20 ?*/abc/?* x//a/ab/abc/y 1
45 21 {abc[cde]efg} abcbefg 0
46 22 {abc[cde]efg} abccefg 1
47 23 {abc[cde]efg} abcdefg 1
48 24 {abc[cde]efg} abceefg 1
49 25 {abc[cde]efg} abcfefg 0
50 26 {abc[^cde]efg} abcbefg 1
51 27 {abc[^cde]efg} abccefg 0
52 28 {abc[^cde]efg} abcdefg 0
53 29 {abc[^cde]efg} abceefg 0
54 30 {abc[^cde]efg} abcfefg 1
55 31 {abc[c-e]efg} abcbefg 0
56 32 {abc[c-e]efg} abccefg 1
57 33 {abc[c-e]efg} abcdefg 1
58 34 {abc[c-e]efg} abceefg 1
59 35 {abc[c-e]efg} abcfefg 0
60 36 {abc[^c-e]efg} abcbefg 1
61 37 {abc[^c-e]efg} abccefg 0
62 38 {abc[^c-e]efg} abcdefg 0
63 39 {abc[^c-e]efg} abceefg 0
64 40 {abc[^c-e]efg} abcfefg 1
65 41 {abc[c-e]efg} abc-efg 0
66 42 {abc[-ce]efg} abc-efg 1
67 43 {abc[ce-]efg} abc-efg 1
68 44 {abc[][*?]efg} {abc]efg} 1
69 45 {abc[][*?]efg} {abc*efg} 1
70 46 {abc[][*?]efg} {abc?efg} 1
71 47 {abc[][*?]efg} {abc[efg} 1
72 48 {abc[^][*?]efg} {abc]efg} 0
73 49 {abc[^][*?]efg} {abc*efg} 0
74 50 {abc[^][*?]efg} {abc?efg} 0
75 51 {abc[^][*?]efg} {abc[efg} 0
76 52 {abc[^][*?]efg} {abcdefg} 1
77 53 {*[xyz]efg} {abcxefg} 1
78 54 {*[xyz]efg} {abcwefg} 0
80 do_test quota-glob-$testnum.1 {
81 sqlite3_quota_glob $::pattern $::text
83 do_test quota-glob-$testnum.2 {
84 sqlite3_quota_glob $::pattern [string map {/ \\} $::text]