Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: third_party/sqlite/sqlite-src-3080704/test/atof1.test

Issue 949043002: Add //third_party/sqlite to dirs_to_snapshot, remove net_sql.patch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # 2012 June 18
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 #
12 # Tests of the sqlite3AtoF() function.
13 #
14
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17
18 if {![info exists __GNUC__] || [regexp arm $tcl_platform(machine)]} {
19 finish_test
20 return
21 }
22
23 expr srand(1)
24 for {set i 1} {$i<20000} {incr i} {
25 set pow [expr {int((rand()-0.5)*100)}]
26 set x [expr {pow((rand()-0.5)*2*rand(),$pow)}]
27 set xf [format %.32e $x]
28
29 # Verify that text->real conversions get exactly same ieee754 floating-
30 # point value in SQLite as they do in TCL.
31 #
32 do_test atof1-1.$i.1 {
33 set y [db eval "SELECT $xf=\$x"]
34 if {!$y} {
35 puts -nonewline \173[db eval "SELECT real2hex($xf), real2hex(\$x)"]\175
36 db eval "SELECT $xf+0.0 AS a, \$x AS b" {
37 puts [format "\n%.60e\n%.60e\n%.60e" $x $a $b]
38 }
39 }
40 set y
41 } {1}
42
43 # Verify that round-trip real->text->real conversions using the quote()
44 # function preserve the bits of the numeric value exactly.
45 #
46 do_test atof1-1.$i.2 {
47 set y [db eval {SELECT $x=CAST(quote($x) AS real)}]
48 if {!$y} {
49 db eval {SELECT real2hex($x) a, real2hex(CAST(quote($x) AS real)) b} {}
50 puts "\nIN: $a $xf"
51 puts [format {QUOTE: %16s %s} {} [db eval {SELECT quote($x)}]]
52 db eval {SELECT CAST(quote($x) AS real) c} {}
53 puts "OUT: $b [format %.32e $c]"
54 }
55 set y
56 } {1}
57 }
58
59
60 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3080704/test/async5.test ('k') | third_party/sqlite/sqlite-src-3080704/test/attach.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698