summaryrefslogtreecommitdiffstats
path: root/test/rowvalueA.test
blob: 8760c2c396f3cf31a8c184b50b31fab321d7161b (plain)
1
2
3
4
5
6
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
# 2021 July 6
#
# 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 regression tests for SQLite library.
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix rowvalueA

do_execsql_test 1.0 {
  SELECT (1, 2) IN ( (3, 4), (5, 6), (1, 3) );
} {0}

do_execsql_test 1.1 {
  SELECT (1, 2) IN ( (3, 4), (5, 6), (1, 2) );
} {1}

do_execsql_test 1.2 {
  SELECT (1, 2) IN ( (3, 2) );
} {0}

do_execsql_test 1.3 {
  SELECT (1, 2) IN ( (1, 2) );
} {1}

do_execsql_test 1.4 {
  SELECT (1, 2) IN ( );
} {0}

do_execsql_test 1.5 {
  SELECT (1, 2) NOT IN ( );
} {1}

for {set ii 0} {$ii < 2000} {incr ii} {
  lappend L "($ii, $ii)"
}

do_execsql_test 1.6.1 "
  SELECT (400,400) IN ( [join $L ,] )
" 1

do_execsql_test 1.6.2 "
  SELECT (1500,1500) IN ( [join $L ,] )
" 1

do_execsql_test 1.6.2 "
  SELECT (1500,1499) IN ( [join $L ,] )
" 0

#-------------------------------------------------------------------------

do_catchsql_test 2.0 {
  SELECT (1, 2) IN ( (1, 2), (3, 4, 5), (5, 6) )
} {1 {IN(...) element has 3 terms - expected 2}}

do_catchsql_test 2.1 {
  SELECT (1, 2) IN ( (1, 2), 4, (5, 6) )
} {1 {IN(...) element has 1 term - expected 2}}

do_catchsql_test 2.2 {
  SELECT (1, 2, 3) IN ( (1, 2), (3, 4), (5, 6) )
} {1 {IN(...) element has 2 terms - expected 3}}

do_catchsql_test 2.3 {
  SELECT 2 IN ( (1, 2), (3, 4), (5, 6) )
} {1 {row value misused}}

finish_test