1# 2013-12-17 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. The 12# focus of this file is testing the printf() SQL function. 13# 14 15set testdir [file dirname $argv0] 16source $testdir/tester.tcl 17 18do_execsql_test printf2-1.1 { 19 SELECT printf(); 20} {{}} 21do_execsql_test printf2-1.2 { 22 SELECT printf('hello'); 23} {hello} 24do_execsql_test printf2-1.3 { 25 SELECT printf('%d,%d,%d',55,-11,3421); 26} {55,-11,3421} 27do_execsql_test printf2-1.4 { 28 SELECT printf('%d,%d,%d',55,'-11',3421); 29} {55,-11,3421} 30do_execsql_test printf2-1.5 { 31 SELECT printf('%d,%d,%d,%d',55,'-11',3421); 32} {55,-11,3421,0} 33do_execsql_test printf2-1.6 { 34 SELECT printf('%.2f',3.141592653); 35} {3.14} 36do_execsql_test printf2-1.7 { 37 SELECT printf('%.*f',2,3.141592653); 38} {3.14} 39do_execsql_test printf2-1.8 { 40 SELECT printf('%*.*f',5,2,3.141592653); 41} {{ 3.14}} 42do_execsql_test printf2-1.9 { 43 SELECT printf('%d',314159.2653); 44} {314159} 45do_execsql_test printf2-1.10 { 46 SELECT printf('%lld',314159.2653); 47} {314159} 48do_execsql_test printf2-1.11 { 49 SELECT printf('%lld%n',314159.2653,'hi'); 50} {314159} 51do_execsql_test printf2-1.12 { 52 SELECT printf('%.*z',5,'abcdefghijklmnop'); 53} {abcde} 54do_execsql_test printf2-1.13 { 55 SELECT printf('%c','abcdefghijklmnop'); 56} {a} 57 58 59finish_test 60