1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Fix some of the new date/time function features to comply with the spec.

Update requirement marks.

FossilOrigin-Name: 2f5dc7a9eed89baf6814e9e123354b262c806c853dee1243c93286c564b9aba8
This commit is contained in:
drh
2022-01-21 18:57:30 +00:00
parent e482fde6ee
commit a1c8151bab
5 changed files with 26 additions and 20 deletions

View File

@ -12,10 +12,13 @@
# focus of this file is testing the printf() SQL function.
#
#
# EVIDENCE-OF: R-63057-40065 The printf(FORMAT,...) SQL function works
# EVIDENCE-OF: R-32560-14372 The format(FORMAT,...) SQL function works
# like the sqlite3_mprintf() C-language function and the printf()
# function from the standard C library.
#
# EVIDENCE-OF: R-64900-53159 The printf() SQL function is an alias for
# the format() SQL function.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -24,7 +27,7 @@ source $testdir/tester.tcl
# then the result is NULL.
#
do_execsql_test printf2-1.1 {
SELECT quote(printf()), quote(printf(NULL,1,2,3));
SELECT quote(format()), quote(format(NULL,1,2,3));
} {NULL NULL}
@ -32,31 +35,31 @@ do_execsql_test printf2-1.2 {
SELECT printf('hello');
} {hello}
do_execsql_test printf2-1.3 {
SELECT printf('%d,%d,%d',55,-11,3421);
SELECT format('%d,%d,%d',55,-11,3421);
} {55,-11,3421}
do_execsql_test printf2-1.4 {
SELECT printf('%d,%d,%d',55,'-11',3421);
} {55,-11,3421}
do_execsql_test printf2-1.5 {
SELECT printf('%d,%d,%d,%d',55,'-11',3421);
SELECT format('%d,%d,%d,%d',55,'-11',3421);
} {55,-11,3421,0}
do_execsql_test printf2-1.6 {
SELECT printf('%.2f',3.141592653);
} {3.14}
do_execsql_test printf2-1.7 {
SELECT printf('%.*f',2,3.141592653);
SELECT format('%.*f',2,3.141592653);
} {3.14}
do_execsql_test printf2-1.8 {
SELECT printf('%*.*f',5,2,3.141592653);
} {{ 3.14}}
do_execsql_test printf2-1.9 {
SELECT printf('%d',314159.2653);
SELECT format('%d',314159.2653);
} {314159}
do_execsql_test printf2-1.10 {
SELECT printf('%lld',314159.2653);
} {314159}
do_execsql_test printf2-1.11 {
SELECT printf('%lld%n',314159.2653,'hi');
SELECT format('%lld%n',314159.2653,'hi');
} {314159}
do_execsql_test printf2-1.12 {
SELECT printf('%n',0);
@ -65,7 +68,7 @@ do_execsql_test printf2-1.12 {
# EVIDENCE-OF: R-17002-27534 The %z format is interchangeable with %s.
#
do_execsql_test printf2-1.12 {
SELECT printf('%.*z',5,'abcdefghijklmnop');
SELECT format('%.*z',5,'abcdefghijklmnop');
} {abcde}
do_execsql_test printf2-1.13 {
SELECT printf('%c','abcdefghijklmnop');