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

Side by Side Diff: third_party/sqlite/sqlite-src-3080704/test/func5.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, 9 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 # 2013-11-21
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 # Testing of function factoring and the SQLITE_DETERMINISTIC flag.
13 #
14 set testdir [file dirname $argv0]
15 source $testdir/tester.tcl
16
17 # Verify that constant string expressions that get factored into initializing
18 # code are not reused between function parameters and other values in the
19 # VDBE program, as the function might have changed the encoding.
20 #
21 do_execsql_test func5-1.1 {
22 PRAGMA encoding=UTF16le;
23 CREATE TABLE t1(x,a,b,c);
24 INSERT INTO t1 VALUES(1,'ab','cd',1);
25 INSERT INTO t1 VALUES(2,'gh','ef',5);
26 INSERT INTO t1 VALUES(3,'pqr','fuzzy',99);
27 INSERT INTO t1 VALUES(4,'abcdefg','xy',22);
28 INSERT INTO t1 VALUES(5,'shoe','mayer',2953);
29 SELECT x FROM t1 WHERE c=instr('abcdefg',b) OR a='abcdefg' ORDER BY +x;
30 } {2 4}
31 do_execsql_test func5-1.2 {
32 SELECT x FROM t1 WHERE a='abcdefg' OR c=instr('abcdefg',b) ORDER BY +x;
33 } {2 4}
34
35 # Verify that SQLITE_DETERMINISTIC functions get factored out of the
36 # evaluation loop whereas non-deterministic functions do not. counter1()
37 # is marked as non-deterministic and so is not factored out of the loop,
38 # and it really is non-deterministic, returning a different result each
39 # time. But counter2() is marked as deterministic, so it does get factored
40 # out of the loop. counter2() has the same implementation as counter1(),
41 # returning a different result on each invocation, but because it is
42 # only invoked once outside of the loop, it appears to return the same
43 # result multiple times.
44 #
45 do_execsql_test func5-2.1 {
46 CREATE TABLE t2(x,y);
47 INSERT INTO t2 VALUES(1,2),(3,4),(5,6),(7,8);
48 SELECT x, y FROM t2 WHERE x+5=5+x ORDER BY +x;
49 } {1 2 3 4 5 6 7 8}
50 sqlite3_create_function db
51 do_execsql_test func5-2.2 {
52 SELECT x, y FROM t2
53 WHERE x+counter1('hello')=counter1('hello')+x
54 ORDER BY +x;
55 } {}
56 do_execsql_test func5-2.3 {
57 SELECT x, y FROM t2
58 WHERE x+counter2('hello')=counter2('hello')+x
59 ORDER BY +x;
60 } {1 2 3 4 5 6 7 8}
61
62
63 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3080704/test/func4.test ('k') | third_party/sqlite/sqlite-src-3080704/test/fuzz.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698