Index: .fossil-settings/ignore-glob ================================================================== --- .fossil-settings/ignore-glob +++ .fossil-settings/ignore-glob @@ -16,5 +16,7 @@ config.log config.status configure extra.mk tests/tests +tests/tests.db +tests/tests.exe Index: tests/Makefile ================================================================== --- tests/Makefile +++ tests/Makefile @@ -39,7 +39,7 @@ exit $$EXIT ${PROG_NOINST}: ${LIBOBJSQLITE3_DEP} CPPFLAGS += -I../src -LIBS := ${OBJFW_LIBS} ${LIBS} +LIBS := -L../src -lobjsqlite3 ${OBJFW_LIBS} ${LIBS} LD = ${OBJC} Index: tests/Tests.m ================================================================== --- tests/Tests.m +++ tests/Tests.m @@ -31,8 +31,39 @@ 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