tkt-f973c7ac31.test 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # 2010 June 09
  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. # This file implements regression tests for SQLite library.
  12. #
  13. set testdir [file dirname $argv0]
  14. source $testdir/tester.tcl
  15. do_test tkt-f973c7ac3-1.0 {
  16. execsql {
  17. CREATE TABLE t(c1 INTEGER, c2 INTEGER);
  18. INSERT INTO t VALUES(5, 5);
  19. INSERT INTO t VALUES(5, 4);
  20. }
  21. } {}
  22. foreach {tn sql} {
  23. 1 ""
  24. 2 "CREATE INDEX i1 ON t(c1, c2)"
  25. } {
  26. execsql $sql
  27. do_test tkt-f973c7ac3-1.$tn.1 {
  28. execsql {
  29. SELECT * FROM t WHERE c1 = 5 AND c2>0 AND c2<='2' ORDER BY c2 DESC
  30. }
  31. } {}
  32. do_test tkt-f973c7ac3-1.$tn.2 {
  33. execsql {
  34. SELECT * FROM t WHERE c1 = 5 AND c2>0 AND c2<=5 ORDER BY c2 DESC
  35. }
  36. } {5 5 5 4}
  37. do_test tkt-f973c7ac3-1.$tn.3 {
  38. execsql {
  39. SELECT * FROM t WHERE c1 = 5 AND c2>0 AND c2<='5' ORDER BY c2 DESC
  40. }
  41. } {5 5 5 4}
  42. do_test tkt-f973c7ac3-1.$tn.4 {
  43. execsql {
  44. SELECT * FROM t WHERE c1 = 5 AND c2>'0' AND c2<=5 ORDER BY c2 DESC
  45. }
  46. } {5 5 5 4}
  47. do_test tkt-f973c7ac3-1.$tn.5 {
  48. execsql {
  49. SELECT * FROM t WHERE c1 = 5 AND c2>'0' AND c2<='5' ORDER BY c2 DESC
  50. }
  51. } {5 5 5 4}
  52. do_test tkt-f973c7ac3-1.$tn.6 {
  53. execsql {
  54. SELECT * FROM t WHERE c1 = 5 AND c2>0 AND c2<='2' ORDER BY c2 ASC
  55. }
  56. } {}
  57. do_test tkt-f973c7ac3-1.$tn.7 {
  58. execsql {
  59. SELECT * FROM t WHERE c1 = 5 AND c2>0 AND c2<=5 ORDER BY c2 ASC
  60. }
  61. } {5 4 5 5}
  62. do_test tkt-f973c7ac3-1.$tn.8 {
  63. execsql {
  64. SELECT * FROM t WHERE c1 = 5 AND c2>0 AND c2<='5' ORDER BY c2 ASC
  65. }
  66. } {5 4 5 5}
  67. do_test tkt-f973c7ac3-1.$tn.9 {
  68. execsql {
  69. SELECT * FROM t WHERE c1 = 5 AND c2>'0' AND c2<=5 ORDER BY c2 ASC
  70. }
  71. } {5 4 5 5}
  72. do_test tkt-f973c7ac3-1.$tn.10 {
  73. execsql {
  74. SELECT * FROM t WHERE c1 = 5 AND c2>'0' AND c2<='5' ORDER BY c2 ASC
  75. }
  76. } {5 4 5 5}
  77. }
  78. finish_test