]> gitweb.factorcode.org Git - factor.git/blob - libs/sqlite/tuple-db-tests.factor
f412abb56a2312b769e78dd00e5968a2fabbf14d
[factor.git] / libs / sqlite / tuple-db-tests.factor
1 ! Copyright (C) 2005 Chris Double.
2 ! See http://factorcode.org/license.txt for BSD license.
3
4 IN: tuple-db
5 USING: io kernel sequences namespaces
6 hashtables sqlite errors math words generic test ;
7
8 TUPLE: testdata one two ;
9
10 testdata default-mapping set-mapping
11
12 "libs/sqlite/test.db" resource-path [
13
14     db get testdata create-tuple-table
15
16     [ "two" [ ] ] [
17     db get "one" "two" <testdata> insert-tuple
18     db get "one" f <testdata> find-tuples 
19     first [ testdata-two ] keep
20     db get swap delete-tuple    
21     db get "one" f <testdata> find-tuples 
22     ] unit-test
23
24     [ "junk" ] [
25     db get "one" "two" <testdata> insert-tuple
26     db get "one" f <testdata> find-tuples 
27     first  
28     "junk" over set-testdata-two
29     db get swap update-tuple
30     db get "one" f <testdata> find-tuples 
31     first [ testdata-two ] keep
32     db get swap delete-tuple      
33     ] unit-test
34
35     db get testdata drop-tuple-table
36 ] with-sqlite
37