Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ccgus/fmdb.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorccgus <gus@flyingmeat.com>2014-01-20 22:01:06 +0400
committerccgus <gus@flyingmeat.com>2014-01-20 22:01:06 +0400
commit7daa30d27a0e67e1ca2032fc5a4dd934899db556 (patch)
tree61eeb8fdc427a077d7705315aa84d3f8e07a0f60 /Tests
parentf7e1a9298a51c558ece7e96702d16bd8eec74ab6 (diff)
Cleanup, and then while debugging a test, noticed that sqlite3_busy_timeout doesn't retry a sqlite3_step for you automatically. So that's a problem that I'll need to fix.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/FMDatabaseAdditionsTests.m7
-rw-r--r--Tests/FMDatabasePoolTests.m13
-rw-r--r--Tests/FMDatabaseTests.m8
3 files changed, 23 insertions, 5 deletions
diff --git a/Tests/FMDatabaseAdditionsTests.m b/Tests/FMDatabaseAdditionsTests.m
index 6164847..b861ef1 100644
--- a/Tests/FMDatabaseAdditionsTests.m
+++ b/Tests/FMDatabaseAdditionsTests.m
@@ -94,4 +94,11 @@
XCTAssertFalse([self.db columnExists:@"c" inTableWithName:@"nulltest"]);
}
+- (void)testUserVersion {
+
+ [[self db] setUserVersion:12];
+
+ XCTAssertTrue([[self db] userVersion] == 12);
+}
+
@end
diff --git a/Tests/FMDatabasePoolTests.m b/Tests/FMDatabasePoolTests.m
index 36183c5..55ce5ea 100644
--- a/Tests/FMDatabasePoolTests.m
+++ b/Tests/FMDatabasePoolTests.m
@@ -36,7 +36,10 @@
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
- self.pool = [FMDatabasePool databasePoolWithPath:self.databasePath];
+ [self setPool:[FMDatabasePool databasePoolWithPath:self.databasePath]];
+
+ [[self pool] setDelegate:self];
+
}
- (void)tearDown
@@ -249,6 +252,14 @@
XCTAssert([self.pool countOfOpenDatabases] < 64, @"There should be significantly less than 64 databases after that stress test");
}
+
+- (BOOL)databasePool:(FMDatabasePool*)pool shouldAddDatabaseToPool:(FMDatabase*)database {
+ [database setRetryTimeout:.1];
+ [database setCrashOnErrors:YES];
+ #pragma message "FIXME: Gus - we need to check for a SQLITE_BUSY when we call sqlite3_step. sqlite will sleep for the retry amount - BUT, it won't just try the step again. We'll have to put the old loops back in. testReadWriteStressTest shows this mistake."
+ return YES;
+}
+
- (void)testReadWriteStressTest
{
int ops = 16;
diff --git a/Tests/FMDatabaseTests.m b/Tests/FMDatabaseTests.m
index 9918309..279f09f 100644
--- a/Tests/FMDatabaseTests.m
+++ b/Tests/FMDatabaseTests.m
@@ -91,8 +91,8 @@
- (void)testPragmaJournalMode
{
- FMResultSet *ps = [self.db executeQuery:@"PRAGMA journal_mode=delete"];
- XCTAssertFalse([self.db hadError], @"PRAGMA should have succeeded");
+ FMResultSet *ps = [self.db executeQuery:@"pragma journal_mode=delete"];
+ XCTAssertFalse([self.db hadError], @"pragma should have succeeded");
XCTAssertNotNil(ps, @"Result set should be non-nil");
XCTAssertTrue([ps next], @"Result set should have a next result");
[ps close];
@@ -101,7 +101,7 @@
- (void)testPragmaPageSize
{
[self.db executeUpdate:@"PRAGMA page_size=2048"];
- XCTAssertFalse([self.db hadError], @"PRAGMA should have succeeded");
+ XCTAssertFalse([self.db hadError], @"pragma should have succeeded");
}
- (void)testVacuum
@@ -670,7 +670,7 @@
- (void)testPragmaDatabaseList
{
- FMResultSet *rs = [self.db executeQuery:@"PRAGMA database_list"];
+ FMResultSet *rs = [self.db executeQuery:@"pragma database_list"];
int counter = 0;
while ([rs next]) {
counter++;