mirror of
https://github.com/sqlite/sqlite.git
synced 2026-10-25 09:59:22 +03:00
60 lines
1.6 KiB
Plaintext
60 lines
1.6 KiB
Plaintext
# 2013-12-17
|
|
#
|
|
# 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 printf() SQL function.
|
|
#
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
|
|
do_execsql_test printf2-1.1 {
|
|
SELECT printf();
|
|
} {{}}
|
|
do_execsql_test printf2-1.2 {
|
|
SELECT printf('hello');
|
|
} {hello}
|
|
do_execsql_test printf2-1.3 {
|
|
SELECT printf('%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);
|
|
} {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);
|
|
} {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);
|
|
} {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');
|
|
} {314159}
|
|
do_execsql_test printf2-1.12 {
|
|
SELECT printf('%.*z',5,'abcdefghijklmnop');
|
|
} {abcde}
|
|
do_execsql_test printf2-1.13 {
|
|
SELECT printf('%c','abcdefghijklmnop');
|
|
} {a}
|
|
|
|
|
|
finish_test
|