more unit tests
parent
a5843a360c
commit
f56b54077b
|
@ -3,7 +3,8 @@
|
||||||
USING: alien.c-types arrays assocs kernel math math.parser
|
USING: alien.c-types arrays assocs kernel math math.parser
|
||||||
namespaces sequences db.sqlite.ffi db combinators
|
namespaces sequences db.sqlite.ffi db combinators
|
||||||
continuations db.types calendar.format serialize
|
continuations db.types calendar.format serialize
|
||||||
io.streams.byte-array byte-arrays io.encodings.binary ;
|
io.streams.byte-array byte-arrays io.encodings.binary
|
||||||
|
tools.walker ;
|
||||||
IN: db.sqlite.lib
|
IN: db.sqlite.lib
|
||||||
|
|
||||||
: sqlite-error ( n -- * )
|
: sqlite-error ( n -- * )
|
||||||
|
@ -137,7 +138,7 @@ IN: db.sqlite.lib
|
||||||
{ BLOB [ sqlite-column-blob ] }
|
{ BLOB [ sqlite-column-blob ] }
|
||||||
{ FACTOR-BLOB [
|
{ FACTOR-BLOB [
|
||||||
sqlite-column-blob
|
sqlite-column-blob
|
||||||
binary [ deserialize ] with-byte-reader
|
dup [ binary [ deserialize ] with-byte-reader ] when
|
||||||
] }
|
] }
|
||||||
! { NULL [ 2drop f ] }
|
! { NULL [ 2drop f ] }
|
||||||
[ no-sql-type ]
|
[ no-sql-type ]
|
||||||
|
|
|
@ -144,7 +144,8 @@ SYMBOL: person4
|
||||||
} define-persistent
|
} define-persistent
|
||||||
1 "billy" 10 3.14 f f f f f <assigned-person> person1 set
|
1 "billy" 10 3.14 f f f f f <assigned-person> person1 set
|
||||||
2 "johnny" 10 3.14 f f f f f <assigned-person> person2 set
|
2 "johnny" 10 3.14 f f f f f <assigned-person> person2 set
|
||||||
3 "teddy" 10 3.14 "2008-03-05 16:24:11" "2008-11-22" "12:34:56" B{ 115 116 111 114 101 105 110 97 98 108 111 98 } f <assigned-person> person3 set ;
|
3 "teddy" 10 3.14 "2008-03-05 16:24:11" "2008-11-22" "12:34:56" B{ 115 116 111 114 101 105 110 97 98 108 111 98 } f <assigned-person> person3 set
|
||||||
|
4 "eddie" 10 3.14 "2008-03-05 16:24:11" "2008-11-22" "12:34:56" f H{ { 1 2 } { 3 4 } { 5 "lol" } } <assigned-person> person4 set ;
|
||||||
|
|
||||||
TUPLE: paste n summary author channel mode contents timestamp annotations ;
|
TUPLE: paste n summary author channel mode contents timestamp annotations ;
|
||||||
TUPLE: annotation n paste-id summary author mode contents ;
|
TUPLE: annotation n paste-id summary author mode contents ;
|
||||||
|
@ -187,11 +188,11 @@ TUPLE: annotation n paste-id summary author mode contents ;
|
||||||
: test-postgresql ( -- )
|
: test-postgresql ( -- )
|
||||||
>r { "localhost" "postgres" "" "factor-test" } postgresql-db r> with-db ;
|
>r { "localhost" "postgres" "" "factor-test" } postgresql-db r> with-db ;
|
||||||
|
|
||||||
! [ native-person-schema test-tuples ] test-sqlite
|
[ native-person-schema test-tuples ] test-sqlite
|
||||||
! [ assigned-person-schema test-tuples ] test-sqlite
|
[ assigned-person-schema test-tuples ] test-sqlite
|
||||||
|
|
||||||
[ native-person-schema test-tuples ] test-postgresql
|
[ native-person-schema test-tuples ] test-postgresql
|
||||||
! [ assigned-person-schema test-tuples ] test-postgresql
|
[ assigned-person-schema test-tuples ] test-postgresql
|
||||||
|
|
||||||
TUPLE: serialize-me id data ;
|
TUPLE: serialize-me id data ;
|
||||||
|
|
||||||
|
@ -209,7 +210,8 @@ TUPLE: serialize-me id data ;
|
||||||
{ T{ serialize-me f 1 H{ { 1 2 } } } }
|
{ T{ serialize-me f 1 H{ { 1 2 } } } }
|
||||||
] [ T{ serialize-me f 1 } select-tuples ] unit-test ;
|
] [ T{ serialize-me f 1 } select-tuples ] unit-test ;
|
||||||
|
|
||||||
! [ test-serialize ] test-sqlite
|
[ test-serialize ] test-sqlite
|
||||||
|
[ test-serialize ] test-postgresql
|
||||||
|
|
||||||
TUPLE: exam id name score ;
|
TUPLE: exam id name score ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue