1: # 2011 December 1
2: #
3: # The author disclaims copyright to this source code. In place of
4: # a legal notice, here is a blessing:
5: #
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.
9: #
10: #***********************************************************************
11: #
12: # Tests for the glob-style string compare operator embedded in the
13: # quota shim.
14: #
15:
16: set testdir [file dirname $argv0]
17: source $testdir/tester.tcl
18:
19: catch { unset testnum }
20: catch { unset pattern }
21: catch { unset text }
22: catch { unset ans }
23:
24: foreach {testnum pattern text ans} {
25: 1 abcdefg abcdefg 1
26: 2 abcdefG abcdefg 0
27: 3 abcdef abcdefg 0
28: 4 abcdefgh abcdefg 0
29: 5 abcdef? abcdefg 1
30: 6 abcdef? abcdef 0
31: 7 abcdef? abcdefgh 0
32: 8 abcdefg abcdef? 0
33: 9 abcdef? abcdef? 1
34: 10 abc/def abc/def 1
35: 11 abc//def abc/def 0
36: 12 */abc/* x/abc/y 1
37: 13 */abc/* /abc/ 1
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
79: } {
80: do_test quota-glob-$testnum.1 {
81: sqlite3_quota_glob $::pattern $::text
82: } $::ans
83: do_test quota-glob-$testnum.2 {
84: sqlite3_quota_glob $::pattern [string map {/ \\} $::text]
85: } $::ans
86: }
87: finish_test
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>