pragma.test 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. # 2002 March 6
  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. # This file implements tests for the PRAGMA command.
  14. #
  15. # $Id: pragma.test,v 1.1 2002/03/06 22:01:37 drh Exp $
  16. set testdir [file dirname $argv0]
  17. source $testdir/tester.tcl
  18. # Delete the preexisting database to avoid the special setup
  19. # that the "all.test" script does.
  20. #
  21. db close
  22. file delete test.db
  23. sqlite db test.db
  24. do_test pragma-1.1 {
  25. execsql {
  26. PRAGMA cache_size;
  27. PRAGMA default_cache_size;
  28. PRAGMA synchronous;
  29. PRAGMA default_synchronous;
  30. }
  31. } {2000 2000 1 1}
  32. do_test pragma-1.2 {
  33. execsql {
  34. PRAGMA cache_size=1234;
  35. PRAGMA cache_size;
  36. PRAGMA default_cache_size;
  37. PRAGMA synchronous;
  38. PRAGMA default_synchronous;
  39. }
  40. } {1234 2000 1 1}
  41. do_test pragma-1.3 {
  42. db close
  43. sqlite db test.db
  44. execsql {
  45. PRAGMA cache_size;
  46. PRAGMA default_cache_size;
  47. PRAGMA synchronous;
  48. PRAGMA default_synchronous;
  49. }
  50. } {2000 2000 1 1}
  51. do_test pragma-1.4 {
  52. execsql {
  53. PRAGMA synchronous=OFF;
  54. PRAGMA cache_size;
  55. PRAGMA default_cache_size;
  56. PRAGMA synchronous;
  57. PRAGMA default_synchronous;
  58. }
  59. } {2000 2000 0 1}
  60. do_test pragma-1.5 {
  61. execsql {
  62. PRAGMA cache_size=4321;
  63. PRAGMA cache_size;
  64. PRAGMA default_cache_size;
  65. PRAGMA synchronous;
  66. PRAGMA default_synchronous;
  67. }
  68. } {4321 2000 0 1}
  69. do_test pragma-1.6 {
  70. execsql {
  71. PRAGMA synchronous=ON;
  72. PRAGMA cache_size;
  73. PRAGMA default_cache_size;
  74. PRAGMA synchronous;
  75. PRAGMA default_synchronous;
  76. }
  77. } {4321 2000 1 1}
  78. do_test pragma-1.7 {
  79. db close
  80. sqlite db test.db
  81. execsql {
  82. PRAGMA cache_size;
  83. PRAGMA default_cache_size;
  84. PRAGMA synchronous;
  85. PRAGMA default_synchronous;
  86. }
  87. } {2000 2000 1 1}
  88. do_test pragma-1.8 {
  89. execsql {
  90. PRAGMA default_synchronous=OFF;
  91. PRAGMA cache_size;
  92. PRAGMA default_cache_size;
  93. PRAGMA synchronous;
  94. PRAGMA default_synchronous;
  95. }
  96. } {2000 2000 0 0}
  97. do_test pragma-1.9 {
  98. execsql {
  99. PRAGMA default_cache_size=123;
  100. PRAGMA cache_size;
  101. PRAGMA default_cache_size;
  102. PRAGMA synchronous;
  103. PRAGMA default_synchronous;
  104. }
  105. } {123 123 0 0}
  106. do_test pragma-1.10 {
  107. db close
  108. sqlite db test.db
  109. execsql {
  110. PRAGMA cache_size;
  111. PRAGMA default_cache_size;
  112. PRAGMA synchronous;
  113. PRAGMA default_synchronous;
  114. }
  115. } {123 123 0 0}
  116. finish_test