Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Improved test coverage for printf.c. (CVS 3780) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c2badb208ff1207a1471410965947893 |
User & Date: | drh 2007-03-31 15:02:49.000 |
Context
2007-03-31
| ||
15:28 | Increase test coverage by statically defining SQLITE_BIGENDIAN and related macros for ix86 platforms. Still a run-time test for other architectures. Need to add additional cases to cover other popular processors. (CVS 3781) (check-in: 476e7c3fcc user: drh tags: trunk) | |
15:02 | Improved test coverage for printf.c. (CVS 3780) (check-in: c2badb208f user: drh tags: trunk) | |
13:00 | The XFER optimization works if the target table lacks an integer primary key and is not empty as long as it has no indices. It always has and continues to work if the target table was empty. (CVS 3779) (check-in: 2c62ffcb86 user: drh tags: trunk) | |
Changes
Changes to src/printf.c.
︙ | ︙ | |||
817 818 819 820 821 822 823 | /* ** Print into memory obtained from sqlite3_malloc()(). Omit the internal ** %-conversion extensions. */ char *sqlite3_mprintf(const char *zFormat, ...){ va_list ap; char *z; | < | | 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 | /* ** Print into memory obtained from sqlite3_malloc()(). Omit the internal ** %-conversion extensions. */ char *sqlite3_mprintf(const char *zFormat, ...){ va_list ap; char *z; va_start(ap, zFormat); z = sqlite3_vmprintf(zFormat, ap); va_end(ap); return z; } /* ** sqlite3_snprintf() works like snprintf() except that it ignores the ** current locale settings. This is important for SQLite because we |
︙ | ︙ |
Changes to src/test1.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing all sorts of SQLite interfaces. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing all sorts of SQLite interfaces. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** ** $Id: test1.c,v 1.232 2007/03/31 15:02:49 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" #include "os.h" #include <stdlib.h> #include <string.h> |
︙ | ︙ | |||
929 930 931 932 933 934 935 936 937 938 939 940 941 942 | if( Tcl_GetInt(interp, argv[i], &a[i-2]) ) return TCL_ERROR; } z = sqlite3_mprintf(argv[1], a[0], a[1], argc>4 ? argv[4] : NULL); Tcl_AppendResult(interp, z, 0); sqlite3_free(z); return TCL_OK; } /* ** Usage: sqlite3_mprintf_double FORMAT INTEGER INTEGER DOUBLE ** ** Call mprintf with two integer arguments and one double argument */ static int sqlite3_mprintf_double( | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 | if( Tcl_GetInt(interp, argv[i], &a[i-2]) ) return TCL_ERROR; } z = sqlite3_mprintf(argv[1], a[0], a[1], argc>4 ? argv[4] : NULL); Tcl_AppendResult(interp, z, 0); sqlite3_free(z); return TCL_OK; } /* ** Usage: sqlite3_snprintf_str INTEGER FORMAT INTEGER INTEGER STRING ** ** Call mprintf with two integer arguments and one string argument */ static int sqlite3_snprintf_str( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ int a[3], i; int n; char *z; if( argc<5 || argc>6 ){ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " INT FORMAT INT INT ?STRING?\"", 0); return TCL_ERROR; } if( Tcl_GetInt(interp, argv[1], &n) ) return TCL_ERROR; if( n<0 ){ Tcl_AppendResult(interp, "N must be non-negative", 0); return TCL_ERROR; } for(i=3; i<5; i++){ if( Tcl_GetInt(interp, argv[i], &a[i-3]) ) return TCL_ERROR; } z = sqlite3_malloc( n+1 ); sqlite3_snprintf(n, z, argv[2], a[0], a[1], argc>4 ? argv[5] : NULL); Tcl_AppendResult(interp, z, 0); sqlite3_free(z); return TCL_OK; } /* ** Usage: sqlite3_mprintf_double FORMAT INTEGER INTEGER DOUBLE ** ** Call mprintf with two integer arguments and one double argument */ static int sqlite3_mprintf_double( |
︙ | ︙ | |||
4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 | static struct { char *zName; Tcl_CmdProc *xProc; } aCmd[] = { { "sqlite3_mprintf_int", (Tcl_CmdProc*)sqlite3_mprintf_int }, { "sqlite3_mprintf_int64", (Tcl_CmdProc*)sqlite3_mprintf_int64 }, { "sqlite3_mprintf_str", (Tcl_CmdProc*)sqlite3_mprintf_str }, { "sqlite3_mprintf_stronly", (Tcl_CmdProc*)sqlite3_mprintf_stronly}, { "sqlite3_mprintf_double", (Tcl_CmdProc*)sqlite3_mprintf_double }, { "sqlite3_mprintf_scaled", (Tcl_CmdProc*)sqlite3_mprintf_scaled }, { "sqlite3_mprintf_hexdouble", (Tcl_CmdProc*)sqlite3_mprintf_hexdouble}, { "sqlite3_mprintf_z_test", (Tcl_CmdProc*)test_mprintf_z }, { "sqlite3_mprintf_n_test", (Tcl_CmdProc*)test_mprintf_n }, { "sqlite3_last_insert_rowid", (Tcl_CmdProc*)test_last_rowid }, | > | 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 | static struct { char *zName; Tcl_CmdProc *xProc; } aCmd[] = { { "sqlite3_mprintf_int", (Tcl_CmdProc*)sqlite3_mprintf_int }, { "sqlite3_mprintf_int64", (Tcl_CmdProc*)sqlite3_mprintf_int64 }, { "sqlite3_mprintf_str", (Tcl_CmdProc*)sqlite3_mprintf_str }, { "sqlite3_snprintf_str", (Tcl_CmdProc*)sqlite3_snprintf_str }, { "sqlite3_mprintf_stronly", (Tcl_CmdProc*)sqlite3_mprintf_stronly}, { "sqlite3_mprintf_double", (Tcl_CmdProc*)sqlite3_mprintf_double }, { "sqlite3_mprintf_scaled", (Tcl_CmdProc*)sqlite3_mprintf_scaled }, { "sqlite3_mprintf_hexdouble", (Tcl_CmdProc*)sqlite3_mprintf_hexdouble}, { "sqlite3_mprintf_z_test", (Tcl_CmdProc*)test_mprintf_z }, { "sqlite3_mprintf_n_test", (Tcl_CmdProc*)test_mprintf_n }, { "sqlite3_last_insert_rowid", (Tcl_CmdProc*)test_last_rowid }, |
︙ | ︙ |
Changes to test/printf.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the sqlite_*_printf() interface. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the sqlite_*_printf() interface. # # $Id: printf.test,v 1.22 2007/03/31 15:02:50 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl set n 1 foreach v {1 2 5 10 99 100 1000000 999999999 0 -1 -2 -5 -10 -99 -100 -9999999} { set v32 [expr {$v&0xffffffff}] |
︙ | ︙ | |||
89 90 91 92 93 94 95 96 97 98 99 100 101 102 | } [format {%d %d A String: (%s)} 1 2 {This is the string}] do_test printf-3.5 { sqlite3_mprintf_str {%d %d A String: (%30s)} 1 2 {This is the string} } [format {%d %d A String: (%30s)} 1 2 {This is the string}] do_test printf-3.6 { sqlite3_mprintf_str {%d %d A String: (%-30s)} 1 2 {This is the string} } [format {%d %d A String: (%-30s)} 1 2 {This is the string}] do_test printf-4.1 { sqlite3_mprintf_str {%d %d A quoted string: '%q'} 1 2 {Hi Y'all} } {1 2 A quoted string: 'Hi Y''all'} do_test printf-4.2 { sqlite3_mprintf_str {%d %d A NULL pointer in %%q: '%q'} 1 2 } {1 2 A NULL pointer in %q: '(NULL)'} | > > > > > > > > > > > > > > > > > > > > > > > > > > > | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | } [format {%d %d A String: (%s)} 1 2 {This is the string}] do_test printf-3.5 { sqlite3_mprintf_str {%d %d A String: (%30s)} 1 2 {This is the string} } [format {%d %d A String: (%30s)} 1 2 {This is the string}] do_test printf-3.6 { sqlite3_mprintf_str {%d %d A String: (%-30s)} 1 2 {This is the string} } [format {%d %d A String: (%-30s)} 1 2 {This is the string}] do_test snprintf-3.11 { sqlite3_snprintf_str 2 {x%d %d %s} 10 10 {This is the string} } {x} do_test snprintf-3.12 { sqlite3_snprintf_str 3 {x%d %d %s} 10 10 {This is the string} } {x1} do_test snprintf-3.13 { sqlite3_snprintf_str 4 {x%d %d %s} 10 10 {This is the string} } {x10} do_test snprintf-3.14 { sqlite3_snprintf_str 5 {x%d %d %s} 10 10 {This is the string} } {x10 } do_test snprintf-3.15 { sqlite3_snprintf_str 6 {x%d %d %s} 10 10 {This is the string} } {x10 1} do_test snprintf-3.16 { sqlite3_snprintf_str 7 {x%d %d %s} 10 10 {This is the string} } {x10 10} do_test snprintf-3.17 { sqlite3_snprintf_str 8 {x%d %d %s} 10 10 {This is the string} } {x10 10 } do_test snprintf-3.18 { sqlite3_snprintf_str 9 {x%d %d %s} 10 10 {This is the string} } {x10 10 T} do_test snprintf-3.19 { sqlite3_snprintf_str 100 {x%d %d %s} 10 10 {This is the string} } {x10 10 This is the string} do_test printf-4.1 { sqlite3_mprintf_str {%d %d A quoted string: '%q'} 1 2 {Hi Y'all} } {1 2 A quoted string: 'Hi Y''all'} do_test printf-4.2 { sqlite3_mprintf_str {%d %d A NULL pointer in %%q: '%q'} 1 2 } {1 2 A NULL pointer in %q: '(NULL)'} |
︙ | ︙ | |||
233 234 235 236 237 238 239 240 241 242 | do_test printf-14.1 { sqlite3_mprintf_str {abc-%y-123} 0 0 {not used} } {abc-} do_test printf-14.2 { sqlite3_mprintf_n_test {xyzzy} } 5 finish_test | > > > | 260 261 262 263 264 265 266 267 268 269 270 271 272 | do_test printf-14.1 { sqlite3_mprintf_str {abc-%y-123} 0 0 {not used} } {abc-} do_test printf-14.2 { sqlite3_mprintf_n_test {xyzzy} } 5 do_test printf-14.3 { sqlite3_mprintf_str {abc-%T-123} 0 0 {not used} } {abc-} finish_test |
Changes to test/speed2.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2006 November 23 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is measuring executing speed. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2006 November 23 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is measuring executing speed. # # $Id: speed2.test,v 1.5 2007/03/31 15:02:50 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # Set a uniform random seed expr srand(0) |
︙ | ︙ | |||
62 63 64 65 66 67 68 | # Create a database schema. # do_test speed2-1.0 { execsql { PRAGMA page_size=1024; PRAGMA cache_size=8192; | | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | # Create a database schema. # do_test speed2-1.0 { execsql { PRAGMA page_size=1024; PRAGMA cache_size=8192; -- PRAGMA locking_mode=EXCLUSIVE; CREATE TABLE t1(a INTEGER, b INTEGER, c TEXT); CREATE TABLE t2(a INTEGER, b INTEGER, c TEXT); CREATE INDEX i2a ON t2(a); CREATE INDEX i2b ON t2(b); } execsql { SELECT name FROM sqlite_master ORDER BY 1; |
︙ | ︙ |