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

Add the SQLITE_TESTCTRL_RESULT_INTREAL test-control and use it to create

the intreal() SQL function in testfixture.  Write a few simple tests to
prove this all works.  TH3 will hold most of the INTREAL tests, probably.

FossilOrigin-Name: c9838731325e0ca73bd8784c10c74ae043fed7861e6de269fd90e29fa4a19955
This commit is contained in:
drh
2019-05-03 21:17:28 +00:00
parent f2566c4132
commit 0c8f40389e
8 changed files with 122 additions and 12 deletions

52
test/intreal.test Normal file
View File

@ -0,0 +1,52 @@
# 2019-05-03
#
# 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.
#
#***********************************************************************
# Tests to exercise the MEM_IntReal representation of Mem objects.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set ::testprefix intreal
sqlite3_create_function db
do_execsql_test 100 {
SELECT intreal(5);
} {5.0}
do_execsql_test 110 {
SELECT intreal(5)=5, 6=intreal(6);
} {1 1}
do_execsql_test 120 {
SELECT intreal(7)=7.0, 8.0=intreal(8);
} {1 1}
do_execsql_test 130 {
SELECT typeof(intreal(9));
} {real}
do_execsql_test 140 {
SELECT 'a'||intreal(11)||'z';
} {a11.0z}
do_execsql_test 150 {
SELECT max(1.0,intreal(2),3.0), max(1,intreal(2),3);
} {3.0 3}
do_execsql_test 160 {
SELECT max(1.0,intreal(4),3.0), max(1,intreal(4),3);
} {4.0 4.0}
do_execsql_test 170 {
SELECT max(1.0,intreal(2),intreal(3),4.0),
max(1,intreal(2),intreal(3),4);
} {4.0 4}
do_execsql_test 180 {
SELECT max(1.0,intreal(5),intreal(3),4.0),
max(1,intreal(5),intreal(3),4);
} {5.0 5.0}
finish_test