mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Add the "!" flag to the "%g" mprintf conversion parameter to force a
decimal point. This prevents floating point values from appearing as integers. Use this flag when converting floating point to text. Ticket #1362. (CVS 2586) FossilOrigin-Name: 4b98dace6b90abf4a6fe1cd51e6392fd213358c4
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the CREATE TABLE statement.
|
||||
#
|
||||
# $Id: sort.test,v 1.20 2005/07/21 03:15:01 drh Exp $
|
||||
# $Id: sort.test,v 1.21 2005/08/13 12:59:16 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -106,27 +106,27 @@ do_test sort-2.1.1 {
|
||||
UPDATE t1 SET v='x-2b' where v=='x-0.123';
|
||||
SELECT v FROM t1 ORDER BY v;
|
||||
}
|
||||
} {x-123 x-2.15 x-2b x-3.141592653 x-4221 x0.0013442 x1.6 x11}
|
||||
} {x-123.0 x-2.15 x-2b x-3.141592653 x-4221.0 x0.0013442 x1.6 x11}
|
||||
do_test sort-2.1.2 {
|
||||
execsql {
|
||||
SELECT v FROM t1 ORDER BY substr(v,2,999);
|
||||
}
|
||||
} {x-123 x-2.15 x-2b x-3.141592653 x-4221 x0.0013442 x1.6 x11}
|
||||
} {x-123.0 x-2.15 x-2b x-3.141592653 x-4221.0 x0.0013442 x1.6 x11}
|
||||
do_test sort-2.1.3 {
|
||||
execsql {
|
||||
SELECT v FROM t1 ORDER BY substr(v,2,999)+0.0;
|
||||
}
|
||||
} {x-4221 x-123 x-3.141592653 x-2.15 x-2b x0.0013442 x1.6 x11}
|
||||
} {x-4221.0 x-123.0 x-3.141592653 x-2.15 x-2b x0.0013442 x1.6 x11}
|
||||
do_test sort-2.1.4 {
|
||||
execsql {
|
||||
SELECT v FROM t1 ORDER BY substr(v,2,999) DESC;
|
||||
}
|
||||
} {x11 x1.6 x0.0013442 x-4221 x-3.141592653 x-2b x-2.15 x-123}
|
||||
} {x11 x1.6 x0.0013442 x-4221.0 x-3.141592653 x-2b x-2.15 x-123.0}
|
||||
do_test sort-2.1.5 {
|
||||
execsql {
|
||||
SELECT v FROM t1 ORDER BY substr(v,2,999)+0.0 DESC;
|
||||
}
|
||||
} {x11 x1.6 x0.0013442 x-2b x-2.15 x-3.141592653 x-123 x-4221}
|
||||
} {x11 x1.6 x0.0013442 x-2b x-2.15 x-3.141592653 x-123.0 x-4221.0}
|
||||
|
||||
# This is a bug fix for 2.2.4.
|
||||
# Strings are normally mapped to upper-case for a caseless comparison.
|
||||
@ -196,17 +196,17 @@ do_test sort-4.6 {
|
||||
execsql {
|
||||
SELECT v FROM t1 ORDER BY 1;
|
||||
}
|
||||
} {x-123 x-2.15 x-2b x-3.141592653 x-4.0e9 x-4221 x0.0013442 x01234567890123456789 x1.6 x11 x2.7 x5.0e10}
|
||||
} {x-123.0 x-2.15 x-2b x-3.141592653 x-4.0e9 x-4221.0 x0.0013442 x01234567890123456789 x1.6 x11 x2.7 x5.0e10}
|
||||
do_test sort-4.7 {
|
||||
execsql {
|
||||
SELECT v FROM t1 ORDER BY 1 DESC;
|
||||
}
|
||||
} {x5.0e10 x2.7 x11 x1.6 x01234567890123456789 x0.0013442 x-4221 x-4.0e9 x-3.141592653 x-2b x-2.15 x-123}
|
||||
} {x5.0e10 x2.7 x11 x1.6 x01234567890123456789 x0.0013442 x-4221.0 x-4.0e9 x-3.141592653 x-2b x-2.15 x-123.0}
|
||||
do_test sort-4.8 {
|
||||
execsql {
|
||||
SELECT substr(v,2,99) FROM t1 ORDER BY 1;
|
||||
}
|
||||
} {-123 -2.15 -2b -3.141592653 -4.0e9 -4221 0.0013442 01234567890123456789 1.6 11 2.7 5.0e10}
|
||||
} {-123.0 -2.15 -2b -3.141592653 -4.0e9 -4221.0 0.0013442 01234567890123456789 1.6 11 2.7 5.0e10}
|
||||
#do_test sort-4.9 {
|
||||
# execsql {
|
||||
# SELECT substr(v,2,99)+0.0 FROM t1 ORDER BY 1;
|
||||
|
Reference in New Issue
Block a user