quota-glob.test 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. set testdir [file dirname $argv0]
  16. source $testdir/tester.tcl
  17. catch { unset testnum }
  18. catch { unset pattern }
  19. catch { unset text }
  20. catch { unset ans }
  21. foreach {testnum pattern text ans} {
  22. 1 abcdefg abcdefg 1
  23. 2 abcdefG abcdefg 0
  24. 3 abcdef abcdefg 0
  25. 4 abcdefgh abcdefg 0
  26. 5 abcdef? abcdefg 1
  27. 6 abcdef? abcdef 0
  28. 7 abcdef? abcdefgh 0
  29. 8 abcdefg abcdef? 0
  30. 9 abcdef? abcdef? 1
  31. 10 abc/def abc/def 1
  32. 11 abc//def abc/def 0
  33. 12 */abc/* x/abc/y 1
  34. 13 */abc/* /abc/ 1
  35. 16 */abc/* x///a/ab/abc 0
  36. 17 */abc/* x//a/ab/abc/ 1
  37. 16 */abc/* x///a/ab/abc 0
  38. 17 */abc/* x//a/ab/abc/ 1
  39. 18 **/abc/** x//a/ab/abc/ 1
  40. 19 *?/abc/*? x//a/ab/abc/y 1
  41. 20 ?*/abc/?* x//a/ab/abc/y 1
  42. 21 {abc[cde]efg} abcbefg 0
  43. 22 {abc[cde]efg} abccefg 1
  44. 23 {abc[cde]efg} abcdefg 1
  45. 24 {abc[cde]efg} abceefg 1
  46. 25 {abc[cde]efg} abcfefg 0
  47. 26 {abc[^cde]efg} abcbefg 1
  48. 27 {abc[^cde]efg} abccefg 0
  49. 28 {abc[^cde]efg} abcdefg 0
  50. 29 {abc[^cde]efg} abceefg 0
  51. 30 {abc[^cde]efg} abcfefg 1
  52. 31 {abc[c-e]efg} abcbefg 0
  53. 32 {abc[c-e]efg} abccefg 1
  54. 33 {abc[c-e]efg} abcdefg 1
  55. 34 {abc[c-e]efg} abceefg 1
  56. 35 {abc[c-e]efg} abcfefg 0
  57. 36 {abc[^c-e]efg} abcbefg 1
  58. 37 {abc[^c-e]efg} abccefg 0
  59. 38 {abc[^c-e]efg} abcdefg 0
  60. 39 {abc[^c-e]efg} abceefg 0
  61. 40 {abc[^c-e]efg} abcfefg 1
  62. 41 {abc[c-e]efg} abc-efg 0
  63. 42 {abc[-ce]efg} abc-efg 1
  64. 43 {abc[ce-]efg} abc-efg 1
  65. 44 {abc[][*?]efg} {abc]efg} 1
  66. 45 {abc[][*?]efg} {abc*efg} 1
  67. 46 {abc[][*?]efg} {abc?efg} 1
  68. 47 {abc[][*?]efg} {abc[efg} 1
  69. 48 {abc[^][*?]efg} {abc]efg} 0
  70. 49 {abc[^][*?]efg} {abc*efg} 0
  71. 50 {abc[^][*?]efg} {abc?efg} 0
  72. 51 {abc[^][*?]efg} {abc[efg} 0
  73. 52 {abc[^][*?]efg} {abcdefg} 1
  74. 53 {*[xyz]efg} {abcxefg} 1
  75. 54 {*[xyz]efg} {abcwefg} 0
  76. } {
  77. do_test quota-glob-$testnum.1 {
  78. sqlite3_quota_glob $::pattern $::text
  79. } $::ans
  80. do_test quota-glob-$testnum.2 {
  81. sqlite3_quota_glob $::pattern [string map {/ \\} $::text]
  82. } $::ans
  83. }
  84. finish_test