mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Test cases for hex literals.
FossilOrigin-Name: 19054339c47448bcdfd1f7be35daa3826c409077
This commit is contained in:
16
manifest
16
manifest
@@ -1,5 +1,5 @@
|
||||
C Add\ssupport\sfor\sparsing\sC-style\shexadecimal\sliterals.
|
||||
D 2014-07-23T01:26:51.616
|
||||
C Test\scases\sfor\shex\sliterals.
|
||||
D 2014-07-23T01:56:32.016
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@@ -281,7 +281,7 @@ F src/tokenize.c ae45399d6252b4d736af43bee1576ce7bff86aec
|
||||
F src/trigger.c 66f3470b03b52b395e839155786966e3e037fddb
|
||||
F src/update.c 01564b3c430f6c7b0a35afaf7aba7987206fa3a5
|
||||
F src/utf.c a0314e637768a030e6e84a957d0c4f6ba910cc05
|
||||
F src/util.c 9d87de90e59d78e69ab944f34a03a4228b05de6e
|
||||
F src/util.c eff2c1e5a49a3c64af0fe9f2fb32cada3436a167
|
||||
F src/vacuum.c 3728d74919d4fb1356f9e9a13e27773db60b7179
|
||||
F src/vdbe.c fa74c6563486022920db4d73897bd9b837c7441d
|
||||
F src/vdbe.h c63fad052c9e7388d551e556e119c0bcf6bebdf8
|
||||
@@ -601,6 +601,7 @@ F test/fuzz_malloc.test 328f70aaca63adf29b4c6f06505ed0cf57ca7c26
|
||||
F test/fuzzer1.test d4c52aaf3ef923da293a2653cfab33d02f718a36
|
||||
F test/fuzzerfault.test 8792cd77fd5bce765b05d0c8e01b9edcf8af8536
|
||||
F test/genesis.tcl 1e2e2e8e5cc4058549a154ff1892fe5c9de19f98
|
||||
F test/hexlit.test c7f30348053065b75c189356ffcaf3d09824d57f
|
||||
F test/hook.test 162d7cef7a2d2b04839fe14402934e6a1b79442f
|
||||
F test/icu.test 70df4faca133254c042d02ae342c0a141f2663f4
|
||||
F test/in.test 047c4671328e9032ab95666a67021adbbd36e98e
|
||||
@@ -1183,10 +1184,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 48f40861db4fbd10725a2b8b606d44fe16d5bd27
|
||||
R bc60c63a2067ce5c2bcc7a7ef85e26f4
|
||||
T *branch * hex-literal
|
||||
T *sym-hex-literal *
|
||||
T -sym-trunk *
|
||||
P 34a1f38b7a23c64f5c6e5b34c19a20480be53961
|
||||
R 31f7dbbcb963767edb50861a2259f157
|
||||
U drh
|
||||
Z 425e58328b59810233115ebd1d9053d0
|
||||
Z fe6debea68030ad6a2bb2c17bc2c014e
|
||||
|
||||
@@ -1 +1 @@
|
||||
34a1f38b7a23c64f5c6e5b34c19a20480be53961
|
||||
19054339c47448bcdfd1f7be35daa3826c409077
|
||||
@@ -335,7 +335,7 @@ int sqlite3AtoF(const char *z, double *pResult, int length, u8 enc){
|
||||
z+=incr;
|
||||
}
|
||||
#ifndef SQLITE_OMIT_HEX_INTEGER
|
||||
else if( *z==0
|
||||
else if( *z=='0'
|
||||
&& &z[incr*2]<zEnd
|
||||
&& (z[incr]=='x' || z[incr]=='X')
|
||||
&& sqlite3Isxdigit(z[incr*2])
|
||||
|
||||
150
test/hexlit.test
Normal file
150
test/hexlit.test
Normal file
@@ -0,0 +1,150 @@
|
||||
# 2014-07-23
|
||||
#
|
||||
# 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 tests for hexadecimal literals
|
||||
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
proc hexlit1 {tnum val ans} {
|
||||
do_execsql_test hexlit-$tnum "SELECT $val" $ans
|
||||
}
|
||||
|
||||
hexlit1 100 0x0 0
|
||||
hexlit1 101 0x0000000000000000000000000000000000000000000001 1
|
||||
hexlit1 102 0x2 2
|
||||
hexlit1 103 0x4 4
|
||||
hexlit1 104 0x8 8
|
||||
hexlit1 105 0x00000000000000000000000000000000000000000000010 16
|
||||
hexlit1 103 0x20 32
|
||||
hexlit1 106 0x40 64
|
||||
hexlit1 107 0x80 128
|
||||
hexlit1 108 0x100 256
|
||||
hexlit1 109 0x200 512
|
||||
hexlit1 110 0X400 1024
|
||||
hexlit1 111 0x800 2048
|
||||
hexlit1 112 0x1000 4096
|
||||
hexlit1 113 0x2000 8192
|
||||
hexlit1 114 0x4000 16384
|
||||
hexlit1 115 0x8000 32768
|
||||
hexlit1 116 0x10000 65536
|
||||
hexlit1 117 0x20000 131072
|
||||
hexlit1 118 0x40000 262144
|
||||
hexlit1 119 0x80000 524288
|
||||
hexlit1 120 0x100000 1048576
|
||||
hexlit1 121 0x200000 2097152
|
||||
hexlit1 122 0x400000 4194304
|
||||
hexlit1 123 0x800000 8388608
|
||||
hexlit1 124 0x1000000 16777216
|
||||
hexlit1 125 0x2000000 33554432
|
||||
hexlit1 126 0x4000000 67108864
|
||||
hexlit1 127 0x8000000 134217728
|
||||
hexlit1 128 0x10000000 268435456
|
||||
hexlit1 129 0x20000000 536870912
|
||||
hexlit1 130 0x40000000 1073741824
|
||||
hexlit1 131 0x80000000 2147483648
|
||||
hexlit1 132 0x100000000 4294967296
|
||||
hexlit1 133 0x200000000 8589934592
|
||||
hexlit1 134 0x400000000 17179869184
|
||||
hexlit1 135 0x800000000 34359738368
|
||||
hexlit1 136 0x1000000000 68719476736
|
||||
hexlit1 137 0x2000000000 137438953472
|
||||
hexlit1 138 0x4000000000 274877906944
|
||||
hexlit1 139 0x8000000000 549755813888
|
||||
hexlit1 140 0x10000000000 1099511627776
|
||||
hexlit1 141 0x20000000000 2199023255552
|
||||
hexlit1 142 0x40000000000 4398046511104
|
||||
hexlit1 143 0x80000000000 8796093022208
|
||||
hexlit1 144 0x100000000000 17592186044416
|
||||
hexlit1 145 0x200000000000 35184372088832
|
||||
hexlit1 146 0x400000000000 70368744177664
|
||||
hexlit1 147 0x800000000000 140737488355328
|
||||
hexlit1 148 0x1000000000000 281474976710656
|
||||
hexlit1 149 0x2000000000000 562949953421312
|
||||
hexlit1 150 0x4000000000000 1125899906842624
|
||||
hexlit1 151 0x8000000000000 2251799813685248
|
||||
hexlit1 152 0x10000000000000 4503599627370496
|
||||
hexlit1 153 0x20000000000000 9007199254740992
|
||||
hexlit1 154 0x40000000000000 18014398509481984
|
||||
hexlit1 155 0x80000000000000 36028797018963968
|
||||
hexlit1 156 0x100000000000000 72057594037927936
|
||||
hexlit1 157 0x200000000000000 144115188075855872
|
||||
hexlit1 158 0x400000000000000 288230376151711744
|
||||
hexlit1 159 0x800000000000000 576460752303423488
|
||||
hexlit1 160 0X1000000000000000 1152921504606846976
|
||||
hexlit1 161 0x2000000000000000 2305843009213693952
|
||||
hexlit1 162 0X4000000000000000 4611686018427387904
|
||||
hexlit1 163 0x8000000000000000 -9223372036854775808
|
||||
|
||||
hexlit1 200 0x001 1
|
||||
hexlit1 201 0X002 2
|
||||
hexlit1 202 0x003 3
|
||||
hexlit1 203 0X004 4
|
||||
hexlit1 204 0x005 5
|
||||
hexlit1 205 0X006 6
|
||||
hexlit1 206 0x007 7
|
||||
hexlit1 207 0X008 8
|
||||
hexlit1 208 0x009 9
|
||||
hexlit1 209 0x00a 10
|
||||
hexlit1 210 0x00A 10
|
||||
hexlit1 211 0x00b 11
|
||||
hexlit1 212 0x00B 11
|
||||
hexlit1 213 0x00c 12
|
||||
hexlit1 214 0x00C 12
|
||||
hexlit1 215 0x00d 13
|
||||
hexlit1 216 0x00D 13
|
||||
hexlit1 217 0x00e 14
|
||||
hexlit1 218 0x00E 14
|
||||
hexlit1 219 0x00f 15
|
||||
hexlit1 220 0x00F 15
|
||||
|
||||
proc hexlit2 {tnum hex ans} {
|
||||
do_execsql_test hexlit-$tnum "SELECT printf('%7e',CAST($hex AS real))" $ans
|
||||
}
|
||||
|
||||
hexlit2 300 0x1 1.000000e+00
|
||||
hexlit2 301 0x10 1.600000e+01
|
||||
hexlit2 302 0x100 2.560000e+02
|
||||
hexlit2 303 0x1000 4.096000e+03
|
||||
hexlit2 304 0x10000 6.553600e+04
|
||||
hexlit2 305 0x100000 1.048576e+06
|
||||
hexlit2 306 0x1000000 1.677722e+07
|
||||
hexlit2 307 0x10000000 2.684355e+08
|
||||
hexlit2 308 0x100000000 4.294967e+09
|
||||
hexlit2 309 0x1000000000 6.871948e+10
|
||||
hexlit2 310 0x10000000000 1.099512e+12
|
||||
hexlit2 311 0x100000000000 1.759219e+13
|
||||
hexlit2 312 0x1000000000000 2.814750e+14
|
||||
hexlit2 313 0x10000000000000 4.503600e+15
|
||||
hexlit2 314 0x100000000000000 7.205759e+16
|
||||
hexlit2 315 0x1000000000000000 1.152922e+18
|
||||
hexlit2 316 0x10000000000000000 1.844674e+19
|
||||
hexlit2 317 0x100000000000000000 2.951479e+20
|
||||
hexlit2 318 0x1000000000000000000 4.722366e+21
|
||||
hexlit2 319 0x10000000000000000000 7.555786e+22
|
||||
hexlit2 320 0x100000000000000000000 1.208926e+24
|
||||
hexlit2 321 0x1000000000000000000000 1.934281e+25
|
||||
hexlit2 322 0x10000000000000000000000 3.094850e+26
|
||||
hexlit2 323 0x100000000000000000000000 4.951760e+27
|
||||
hexlit2 324 0x1000000000000000000000000 7.922816e+28
|
||||
hexlit2 325 0x10000000000000000000000000 1.267651e+30
|
||||
hexlit2 326 0x100000000000000000000000000 2.028241e+31
|
||||
hexlit2 327 0x1000000000000000000000000000 3.245186e+32
|
||||
hexlit2 328 0x10000000000000000000000000000 5.192297e+33
|
||||
hexlit2 329 0x100000000000000000000000000000 8.307675e+34
|
||||
|
||||
hexlit2 400 0x7fffffffffffffff 9.223372e+18
|
||||
hexlit2 401 0x8000000000000000 -9.223372e+18
|
||||
hexlit2 402 0xffffffffffffffff -1.000000e+00
|
||||
hexlit2 403 0x10000000000000000 1.844674e+19
|
||||
|
||||
finish_test
|
||||
Reference in New Issue
Block a user