Add initial tests
FossilOrigin-Name: bda6d49813371eee28256e1f609091ca4ff664bb1ddeefcf308998b844a3eb14
This commit is contained in:
parent
68eee4790f
commit
f7aa1209f7
3 changed files with 34 additions and 1 deletions
|
@ -18,3 +18,5 @@ config.status
|
|||
configure
|
||||
extra.mk
|
||||
tests/tests
|
||||
tests/tests.db
|
||||
tests/tests.exe
|
||||
|
|
|
@ -41,5 +41,5 @@ run:
|
|||
${PROG_NOINST}: ${LIBOBJSQLITE3_DEP}
|
||||
|
||||
CPPFLAGS += -I../src
|
||||
LIBS := ${OBJFW_LIBS} ${LIBS}
|
||||
LIBS := -L../src -lobjsqlite3 ${OBJFW_LIBS} ${LIBS}
|
||||
LD = ${OBJC}
|
||||
|
|
|
@ -33,6 +33,37 @@ OF_APPLICATION_DELEGATE(Tests)
|
|||
@implementation Tests
|
||||
- (void)applicationDidFinishLaunching
|
||||
{
|
||||
OFFileManager *fileManager = [OFFileManager defaultManager];
|
||||
SL3Connection *conn;
|
||||
SL3PreparedStatement *stmt;
|
||||
|
||||
if ([fileManager fileExistsAtPath: @"tests.db"])
|
||||
[fileManager removeItemAtPath: @"tests.db"];
|
||||
|
||||
conn = [SL3Connection connectionWithPath: @"tests.db"];
|
||||
|
||||
[conn executeStatement: @"CREATE TABLE test (a INT, b TEXT, c BLOB)"];
|
||||
|
||||
stmt = [conn prepareStatement:
|
||||
@"INSERT INTO test (a, b, c) VALUES ($a, $b, $c)"];
|
||||
[stmt bindWithArray: [OFArray arrayWithObjects:
|
||||
[OFNumber numberWithInt: 5],
|
||||
@"String",
|
||||
[OFData dataWithItems: "abc"
|
||||
count: 3],
|
||||
nil]];
|
||||
[stmt step];
|
||||
|
||||
stmt = [conn prepareStatement:
|
||||
@"INSERT INTO test (a, b, c) VALUES ($a, $b, $c)"];
|
||||
[stmt bindWithDictionary: [OFDictionary dictionaryWithKeysAndObjects:
|
||||
@"$a", [OFNumber numberWithInt: 7],
|
||||
@"$b", @"Test",
|
||||
@"$c", [OFData dataWithItems: "xyz"
|
||||
count: 3],
|
||||
nil]];
|
||||
[stmt step];
|
||||
|
||||
[OFApplication terminate];
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue