Annotation of embedaddon/sqlite3/test/vtabD.test, revision 1.1

1.1     ! misho       1: # 2009 April 14
        !             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: # This file implements regression tests for SQLite library.  The
        !            12: # focus of this file is creating and dropping virtual tables.
        !            13: #
        !            14: # $Id: vtabD.test,v 1.3 2009/06/05 17:09:12 drh Exp $
        !            15: 
        !            16: set testdir [file dirname $argv0]
        !            17: source $testdir/tester.tcl
        !            18: 
        !            19: ifcapable !vtab||!schema_pragmas { finish_test ; return }
        !            20: 
        !            21: # Register the echo module
        !            22: register_echo_module [sqlite3_connection_pointer db]
        !            23: 
        !            24: do_test vtabD-1.1 {
        !            25:   execsql {
        !            26:     CREATE TABLE t1(a, b);
        !            27:     CREATE INDEX i1 ON t1(a);
        !            28:     CREATE INDEX i2 ON t1(b);
        !            29:     CREATE VIRTUAL TABLE tv1 USING echo(t1);
        !            30:   }
        !            31: } {}
        !            32: do_test vtabD-1.2 {
        !            33:   execsql BEGIN
        !            34:   for {set i 0} {$i < 100000} {incr i} {
        !            35:     execsql { INSERT INTO t1 VALUES($i, $i*$i) }
        !            36:   }
        !            37:   execsql COMMIT
        !            38: } {}
        !            39: do_test vtabD-1.3 {
        !            40:   execsql { SELECT * FROM tv1 WHERE a = 1 OR b = 4 }
        !            41: } {1 1 2 4}
        !            42: do_test vtabD-1.4 {
        !            43:   execsql { SELECT * FROM tv1 WHERE a = 1 OR b = 1 }
        !            44: } {1 1}
        !            45: do_test vtabD-1.5 {
        !            46:   execsql { SELECT * FROM tv1 WHERE (a > 0 AND a < 5) OR (b > 15 AND b < 65) }
        !            47: } {1 1 2 4 3 9 4 16 5 25 6 36 7 49 8 64}
        !            48: 
        !            49: do_test vtabD-1.6 {
        !            50:   execsql { SELECT * FROM tv1 WHERE a < 500 OR b = 810000 }
        !            51: } [execsql {
        !            52:   SELECT * FROM t1 WHERE a < 500
        !            53:     UNION ALL
        !            54:   SELECT * FROM t1 WHERE b = 810000 AND NOT (a < 500)
        !            55: }]
        !            56: 
        !            57: do_test vtabD-1.7 {
        !            58:   execsql { SELECT * FROM tv1 WHERE a < 90000 OR b = 8100000000 }
        !            59: } [execsql {
        !            60:   SELECT * FROM t1 WHERE a < 90000
        !            61:     UNION ALL
        !            62:   SELECT * FROM t1 WHERE b = 8100000000 AND NOT (a < 90000)
        !            63: }]
        !            64: 
        !            65: if {[working_64bit_int]} {
        !            66: do_test vtabD-1.8 {
        !            67:   execsql { SELECT * FROM tv1 WHERE a = 90001 OR b = 810000 }
        !            68: } {90001 8100180001 900 810000}
        !            69: }
        !            70: 
        !            71: finish_test

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>