format4.test 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # 2005 December 29
  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 to verify that the new serial_type
  14. # values of 8 (integer 0) and 9 (integer 1) work correctly.
  15. #
  16. set testdir [file dirname $argv0]
  17. source $testdir/tester.tcl
  18. db eval {PRAGMA legacy_file_format=OFF}
  19. # The size of the database depends on whether or not autovacuum
  20. # is enabled.
  21. #
  22. ifcapable autovacuum {
  23. if {[db one {PRAGMA auto_vacuum}]} {
  24. set small 3072
  25. set large 5120
  26. } else {
  27. set small 2048
  28. set large 4096
  29. }
  30. } else {
  31. set small 2048
  32. set large 4096
  33. }
  34. do_test format4-1.1 {
  35. execsql {
  36. CREATE TABLE t1(x0,x1,x2,x3,x4,x5,x6,x7,x8,x9);
  37. INSERT INTO t1 VALUES(0,0,0,0,0,0,0,0,0,0);
  38. INSERT INTO t1 SELECT * FROM t1;
  39. INSERT INTO t1 SELECT * FROM t1;
  40. INSERT INTO t1 SELECT * FROM t1;
  41. INSERT INTO t1 SELECT * FROM t1;
  42. INSERT INTO t1 SELECT * FROM t1;
  43. INSERT INTO t1 SELECT * FROM t1;
  44. }
  45. file size test.db
  46. } $small
  47. do_test format4-1.2 {
  48. execsql {
  49. UPDATE t1 SET x0=1, x1=1, x2=1, x3=1, x4=1, x5=1, x6=1, x7=1, x8=1, x9=1
  50. }
  51. file size test.db
  52. } $small
  53. do_test format4-1.3 {
  54. execsql {
  55. UPDATE t1 SET x0=2, x1=2, x2=2, x3=2, x4=2, x5=2, x6=2, x7=2, x8=2, x9=2
  56. }
  57. file size test.db
  58. } $large
  59. finish_test