-C Add\sthe\sprintf()\sSQL\sfunction.
-D 2013-12-17T16:10:57.193
+C Add\sevidence\smarks\sand\sadditional\stest\scases\sfor\sthe\sprintf()\sSQL\sfunction.
+D 2013-12-17T16:32:56.710
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F test/pragma.test e882183ecd21d064cec5c7aaea174fbd36293429
F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13
F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552
-F test/printf2.test 2f0978059768bb039d3ee09466bdcd06fc7a6a86
+F test/printf2.test 414fcba6d6c10e0a5e58efd213811e5ead4635a0
F test/progress.test a282973d1d17f08071bc58a77d6b80f2a81c354d
F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc
F test/queryonly.test 5f653159e0f552f0552d43259890c1089391dcca
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P 5716fc2341ddd8cf64139e7168597f864da4e10b 3375571a5e267744c19a7c310840256cec57a242
-R 2f73ea36e182ebaad881490b3d78bb71
-T +closed 3375571a5e267744c19a7c310840256cec57a242
+P a1bb62f91a85af0584100c3ad77877a949c30cca
+R 69f0b68d0886123f335b52e69a6c748f
U drh
-Z 3980fde025c24face9a02012ab95cda1
+Z 3ce3ba9d696aa32fcf98b10717e459c0
# This file implements regression tests for SQLite library. The
# focus of this file is testing the printf() SQL function.
#
+#
+# EVIDENCE-OF: R-63057-40065 The printf(FORMAT,...) SQL function works
+# like the sqlite3_mprintf() C-language function and the printf()
+# function from the standard C library.
+#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
+# EVIDENCE-OF: R-40086-60101 If the FORMAT argument is missing or NULL
+# then the result is NULL.
+#
do_execsql_test printf2-1.1 {
- SELECT printf();
-} {{}}
+ SELECT quote(printf()), quote(printf(NULL,1,2,3));
+} {NULL NULL}
+
+
do_execsql_test printf2-1.2 {
SELECT printf('hello');
} {hello}
do_execsql_test printf2-1.11 {
SELECT printf('%lld%n',314159.2653,'hi');
} {314159}
+
+# EVIDENCE-OF: R-20555-31089 The %z format is interchangable with %s.
+#
do_execsql_test printf2-1.12 {
SELECT printf('%.*z',5,'abcdefghijklmnop');
} {abcde}
SELECT printf('%c','abcdefghijklmnop');
} {a}
+# EVIDENCE-OF: R-02347-27622 The %n format is silently ignored and does
+# not consume an argument.
+#
+do_execsql_test printf2-2.1 {
+ CREATE TABLE t1(a,b,c);
+ INSERT INTO t1 VALUES(1,2,3);
+ INSERT INTO t1 VALUES(-1,-2,-3);
+ INSERT INTO t1 VALUES('abc','def','ghi');
+ INSERT INTO t1 VALUES(1.5,2.25,3.125);
+ SELECT printf('(%s)-%n-(%s)',a,b,c) FROM t1 ORDER BY rowid;
+} {(1)--(2) (-1)--(-2) (abc)--(def) (1.5)--(2.25)}
+
+# EVIDENCE-OF: R-56064-04001 The %p format is an alias for %X.
+#
+do_execsql_test printf2-2.2 {
+ SELECT printf('%s=(%p)',a,a) FROM t1 ORDER BY a;
+} {-1=(FFFFFFFFFFFFFFFF) 1=(1) 1.5=(1) abc=(0)}
+
+# EVIDENCE-OF: R-29410-53018 If there are too few arguments in the
+# argument list, missing arguments are assumed to have a NULL value,
+# which is translated into 0 or 0.0 for numeric formats or an empty
+# string for %s.
+#
+do_execsql_test printf2-2.3 {
+ SELECT printf('%s=(%d/%g/%s)',a) FROM t1 ORDER BY a;
+} {-1=(0/0/) 1=(0/0/) 1.5=(0/0/) abc=(0/0/)}
+
finish_test