aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/sqlite/unix/sqlite-3.5.1/test/safety.test
diff options
context:
space:
mode:
authordan miller2007-10-20 02:49:29 +0000
committerdan miller2007-10-20 02:49:29 +0000
commite36d23a85ebff914d74bb541558c2b6082b78edb (patch)
tree54b58fdf162e78af64055282a6035c8d2443389d /libraries/sqlite/unix/sqlite-3.5.1/test/safety.test
parent* Fixed an issue whereby avatar chat distances were being calculated against ... (diff)
downloadopensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.zip
opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.gz
opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.bz2
opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.xz
sqlite source (unix build) added to libraries
Diffstat (limited to 'libraries/sqlite/unix/sqlite-3.5.1/test/safety.test')
-rw-r--r--libraries/sqlite/unix/sqlite-3.5.1/test/safety.test68
1 files changed, 68 insertions, 0 deletions
diff --git a/libraries/sqlite/unix/sqlite-3.5.1/test/safety.test b/libraries/sqlite/unix/sqlite-3.5.1/test/safety.test
new file mode 100644
index 0000000..fb8c56c
--- /dev/null
+++ b/libraries/sqlite/unix/sqlite-3.5.1/test/safety.test
@@ -0,0 +1,68 @@
1# 2005 January 11
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 testing the sqlite3SafetyOn and sqlite3SafetyOff
13# functions. Those routines are not strictly necessary - they are
14# designed to detect misuse of the library.
15#
16# $Id: safety.test,v 1.2 2006/01/03 00:33:50 drh Exp $
17
18set testdir [file dirname $argv0]
19source $testdir/tester.tcl
20
21do_test safety-1.1 {
22 set DB [sqlite3_connection_pointer db]
23 db eval {CREATE TABLE t1(a)}
24 sqlite_set_magic $DB SQLITE_MAGIC_BUSY
25 catchsql {
26 SELECT name FROM sqlite_master;
27 }
28} {1 {library routine called out of sequence}}
29do_test safety-1.2 {
30 sqlite_set_magic $DB SQLITE_MAGIC_OPEN
31 catchsql {
32 SELECT name FROM sqlite_master
33 }
34} {0 t1}
35
36do_test safety-2.1 {
37 proc safety_on {} "sqlite_set_magic $DB SQLITE_MAGIC_BUSY"
38 db function safety_on safety_on
39 catchsql {
40 SELECT safety_on(), name FROM sqlite_master
41 }
42} {1 {library routine called out of sequence}}
43do_test safety-2.2 {
44 catchsql {
45 SELECT 'hello'
46 }
47} {1 {library routine called out of sequence}}
48do_test safety-2.3 {
49 sqlite3_close $DB
50} {SQLITE_MISUSE}
51do_test safety-2.4 {
52 sqlite_set_magic $DB SQLITE_MAGIC_OPEN
53 execsql {
54 SELECT name FROM sqlite_master
55 }
56} {t1}
57
58do_test safety-3.1 {
59 set rc [catch {
60 db eval {SELECT name FROM sqlite_master} {
61 sqlite_set_magic $DB SQLITE_MAGIC_BUSY
62 }
63 } msg]
64 lappend rc $msg
65} {1 {library routine called out of sequence}}
66sqlite_set_magic $DB SQLITE_MAGIC_OPEN
67
68finish_test