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:
authorBen Asher <ben.asher@plangrid.com>2017-09-11 23:54:10 +0300
committerBen Asher <ben.asher@plangrid.com>2017-09-11 23:54:10 +0300
commit89d699a694f6fbbf3da21cefc9decc81aaa37e04 (patch)
tree6249467e7f9735c2cc6465dad6d37bc9b7a04c24 /Tests
parent3475cb2c5338a1c1f1916fe5448dbd9b3e99e47c (diff)
Add tests
Diffstat (limited to 'Tests')
-rw-r--r--Tests/FMDatabaseTests.m22
1 files changed, 22 insertions, 0 deletions
diff --git a/Tests/FMDatabaseTests.m b/Tests/FMDatabaseTests.m
index e99f888..a75b9ac 100644
--- a/Tests/FMDatabaseTests.m
+++ b/Tests/FMDatabaseTests.m
@@ -1464,4 +1464,26 @@
XCTAssertEqual(error.code, 19, @"error code 19 should have been generated");
}
+- (void)testCheckpoint {
+ FMDatabase *db = [[FMDatabase alloc] init];
+ XCTAssertTrue([db open], @"open failed");
+ NSError *error = nil;
+ int frameCount = 0;
+ int checkpointCount = 0;
+ [db checkpoint:FMDBCheckpointModeTruncate name:NULL logFrameCount:&frameCount checkpointCount:&checkpointCount error:&error];
+ // Verify that we're calling the checkpoint interface, which is a decent scope for this test, without going so far as to verify what checkpoint does
+ XCTAssertEqual(frameCount, -1, @"frameCount should be -1 (means not using WAL mode) to verify that we're using the proper checkpoint interface");
+ XCTAssertEqual(checkpointCount, -1, @"checkpointCount should be -1 (means not using WAL mode) to verify that we're using the proper checkpoint interface");
+}
+
+- (void)testImmediateTransaction {
+ FMDatabase *db = [[FMDatabase alloc] init];
+ XCTAssertTrue([db open], @"open failed");
+ [db beginImmediateTransaction];
+ [db beginImmediateTransaction];
+
+ // Verify that beginImmediateTransaction behaves as advertised and starts a transaction
+ XCTAssertEqualObjects([db lastError].localizedDescription, @"cannot start a transaction within a transaction");
+}
+
@end