/ Check-in [9406c0a6]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Stricter test cases.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | location-function
Files: files | file ages | folders
SHA3-256:9406c0a685fd5ff3516a66402b0514a1440652822a5eecf0b7af85929f3079e8
User & Date: drh 2017-12-29 16:37:33
Context
2017-12-29
17:21
Add support for the sqlite_unsupported_offset() SQL function if and only if compiled using -DSQLITE_ENABLE_OFFSET_SQL_FUNC. Use that definition when compiling the command-line shell. check-in: 4f1f1f52 user: drh tags: trunk
16:37
Stricter test cases. Closed-Leaf check-in: 9406c0a6 user: drh tags: location-function
15:19
Fix a typo in the MSVC makefile. check-in: 89e5720a user: drh tags: location-function
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/func6.test.

7
8
9
10
11
12
13




14
15
16
17
18
19
20
21


22
23
24




25
26

27
28
29

30
31
32
33
34
35
36

37
38

39








40



41
42












43








44
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#*************************************************************************
#
# Test cases for the sqlite_unsupported_offset() function.
#




set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !offset_sql_func {
  finish_test
  return
}

do_execsql_test func6-100 {


  CREATE TABLE t1(a,b,c,d);
  WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100)
   INSERT INTO t1(a,b,c,d) SELECT printf('abc%03x',x), x, 1000-x, NULL FROM c;




}
do_execsql_test func6-110 {

  SELECT a, typeof(sqlite_unsupported_offset(a)) FROM t1
   ORDER BY rowid LIMIT 2;
} {abc001 integer abc002 integer}

do_execsql_test func6-120 {
  SELECT a, typeof(sqlite_unsupported_offset(+a)) FROM t1
   ORDER BY rowid LIMIT 2;
} {abc001 null abc002 null}
do_execsql_test func6-130 {
  CREATE INDEX t1a ON t1(a);
  SELECT a, typeof(sqlite_unsupported_offset(a)) FROM t1

   ORDER BY a LIMIT 2;
} {abc001 integer abc002 integer}

do_execsql_test func6-140 {








  SELECT a, typeof(sqlite_unsupported_offset(a)) FROM t1 NOT INDEXED



   ORDER BY a LIMIT 2;
} {abc001 integer abc002 integer}





















finish_test







>
>
>
>








>
>



>
>
>
>


>
|

<
>





|
|
>

<
>

>
>
>
>
>
>
>
>
|
>
>
>

<
>
>
>
>
>
>
>
>
>
>
>
>

>
>
>
>
>
>
>
>

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40
41
42
43
44
45
46
47
48
49

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#*************************************************************************
#
# Test cases for the sqlite_unsupported_offset() function.
#
# Some of the tests in this file depend on the exact placement of content
# within b-tree pages.  Such placement is at the implementations discretion,
# and so it is possible for results to change from one release to the next.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !offset_sql_func {
  finish_test
  return
}

do_execsql_test func6-100 {
  PRAGMA page_size=4096;
  PRAGMA auto_vacuum=NONE;
  CREATE TABLE t1(a,b,c,d);
  WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100)
   INSERT INTO t1(a,b,c,d) SELECT printf('abc%03x',x), x, 1000-x, NULL FROM c;
  CREATE INDEX t1a ON t1(a);
  CREATE INDEX t1bc ON t1(b,c);
  CREATE TABLE t2(x TEXT PRIMARY KEY, y) WITHOUT ROWID;
  INSERT INTO t2(x,y) SELECT a, b FROM t1;
}
do_execsql_test func6-110 {
  SELECT a, sqlite_unsupported_offset(d)/4096 + 1,
            sqlite_unsupported_offset(d)%4096 FROM t1
   ORDER BY rowid LIMIT 2;

} {abc001 2 4084 abc002 2 4069}
do_execsql_test func6-120 {
  SELECT a, typeof(sqlite_unsupported_offset(+a)) FROM t1
   ORDER BY rowid LIMIT 2;
} {abc001 null abc002 null}
do_execsql_test func6-130 {
  SELECT a, sqlite_unsupported_offset(a)/4096+1, 
         sqlite_unsupported_offset(a)%4096
   FROM t1
   ORDER BY a LIMIT 2;

} {abc001 3 4087 abc002 3 4076}
do_execsql_test func6-140 {
  SELECT a, sqlite_unsupported_offset(d)/4096+1, 
         sqlite_unsupported_offset(d)%4096
   FROM t1
   ORDER BY a LIMIT 2;
} {abc001 2 4084 abc002 2 4069}
do_execsql_test func6-150 {
  SELECT a,
         sqlite_unsupported_offset(a)/4096+1, 
         sqlite_unsupported_offset(a)%4096,
         sqlite_unsupported_offset(d)/4096+1, 
         sqlite_unsupported_offset(d)%4096
   FROM t1
   ORDER BY a LIMIT 2;

} {abc001 3 4087 2 4084 abc002 3 4076 2 4069}
do_execsql_test func6-160 {
  SELECT b,
         sqlite_unsupported_offset(b)/4096+1, 
         sqlite_unsupported_offset(b)%4096,
         sqlite_unsupported_offset(c)/4096+1, 
         sqlite_unsupported_offset(c)%4096,
         sqlite_unsupported_offset(d)/4096+1, 
         sqlite_unsupported_offset(d)%4096
   FROM t1
   ORDER BY b LIMIT 2;
} {1 4 4090 4 4090 2 4084 2 4 4081 4 4081 2 4069}


do_execsql_test func6-200 {
  SELECT y, sqlite_unsupported_offset(y)/4096+1,
         sqlite_unsupported_offset(y)%4096
   FROM t2
   ORDER BY x LIMIT 2;
} {1 5 4087 2 5 4076}

finish_test