diff --git a/UITableView+Reorder/UITableView+Reorder.m b/UITableView+Reorder/UITableView+Reorder.m index e1d3a9c..173bd5c 100644 --- a/UITableView+Reorder/UITableView+Reorder.m +++ b/UITableView+Reorder/UITableView+Reorder.m @@ -943,7 +943,7 @@ - (void) verifyConfiguration { NSIndexPath *indexPathForH0; CGFloat h1; NSIndexPath *indexPathForH1; - NSInteger sectionCount = [self.dataSource numberOfSectionsInTableView: self]; + NSInteger sectionCount = [self.dataSource respondsToSelector:@selector(numberOfSectionsInTableView:)] ? [self.dataSource numberOfSectionsInTableView: self] : 1; for( NSInteger section = 0; section < sectionCount; ++section ) { NSInteger rowCount = [self.dataSource tableView: self numberOfRowsInSection: section]; for( NSInteger row = 0; row < rowCount; ++row ) { diff --git a/UITableView+ReorderTests/UITableView_ReorderTests.m b/UITableView+ReorderTests/UITableView_ReorderTests.m index 258305d..bce49d3 100644 --- a/UITableView+ReorderTests/UITableView_ReorderTests.m +++ b/UITableView+ReorderTests/UITableView_ReorderTests.m @@ -53,32 +53,32 @@ - (void) test_NSIndexPathIsAboveRowAtIndexPath { NSIndexPath *rowB; rowA = [NSIndexPath indexPathForRow: 0 inSection: 0]; - XCTAssertFalse( [rowA isAboveRowAtIndexPath: nil], @"Row %d,%d cannot be above nil", rowA.section, rowA.row ); + XCTAssertFalse( [rowA isAboveRowAtIndexPath: nil], @"Row %ld,%ld cannot be above nil",(long)rowA.section, (long)rowA.row ); rowB = [NSIndexPath indexPathForRow: 0 inSection: 0]; - XCTAssertFalse( [rowA isAboveRowAtIndexPath: rowB], @"Row %d,%d should not be above %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertFalse( [rowA isAboveRowAtIndexPath: rowB], @"Row %ld,%ld should not be above %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowB = [NSIndexPath indexPathForRow: 1 inSection: 0]; - XCTAssertTrue( [rowA isAboveRowAtIndexPath: rowB], @"Row %d,%d should be above %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertTrue( [rowA isAboveRowAtIndexPath: rowB], @"Row %ld,%ld should be above %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowB = [NSIndexPath indexPathForRow: 0 inSection: 1]; - XCTAssertTrue( [rowA isAboveRowAtIndexPath: rowB], @"Row %d,%d should be above %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertTrue( [rowA isAboveRowAtIndexPath: rowB], @"Row %ld,%ld should be above %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowB = [NSIndexPath indexPathForRow: 1 inSection: 1]; - XCTAssertTrue( [rowA isAboveRowAtIndexPath: rowB], @"Row %d,%d should be above %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertTrue( [rowA isAboveRowAtIndexPath: rowB], @"Row %ld,%ld should be above %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowA = [NSIndexPath indexPathForRow: 2 inSection: 3]; - XCTAssertFalse( [rowA isAboveRowAtIndexPath: nil], @"Row %d,%d cannot be above nil", rowA.section, rowA.row ); + XCTAssertFalse( [rowA isAboveRowAtIndexPath: nil], @"Row %ld,%ld cannot be above nil", (long)rowA.section, (long)rowA.row ); rowB = [NSIndexPath indexPathForRow: 0 inSection: 0]; - XCTAssertFalse( [rowA isAboveRowAtIndexPath: rowB], @"Row %d,%d should not be above %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertFalse( [rowA isAboveRowAtIndexPath: rowB], @"Row %ld,%ld should not be above %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowB = [NSIndexPath indexPathForRow: 1 inSection: 0]; - XCTAssertFalse( [rowA isAboveRowAtIndexPath: rowB], @"Row %d,%d should not be above %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertFalse( [rowA isAboveRowAtIndexPath: rowB], @"Row %ld,%ld should not be above %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowB = [NSIndexPath indexPathForRow: 0 inSection: 1]; - XCTAssertFalse( [rowA isAboveRowAtIndexPath: rowB], @"Row %d,%d should not be above %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertFalse( [rowA isAboveRowAtIndexPath: rowB], @"Row %ld,%ld should not be above %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowB = [NSIndexPath indexPathForRow: 2 inSection: 3]; - XCTAssertFalse( [rowA isAboveRowAtIndexPath: rowB], @"Row %d,%d should not be above %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertFalse( [rowA isAboveRowAtIndexPath: rowB], @"Row %ld,%ld should not be above %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowB = [NSIndexPath indexPathForRow: 3 inSection: 3]; - XCTAssertTrue( [rowA isAboveRowAtIndexPath: rowB], @"Row %d,%d should be above %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertTrue( [rowA isAboveRowAtIndexPath: rowB], @"Row %ld,%ld should be above %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowB = [NSIndexPath indexPathForRow: 0 inSection: 4]; - XCTAssertTrue( [rowA isAboveRowAtIndexPath: rowB], @"Row %d,%d should be above %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertTrue( [rowA isAboveRowAtIndexPath: rowB], @"Row %ld,%ld should be above %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowB = [NSIndexPath indexPathForRow: 3 inSection: 4]; - XCTAssertTrue( [rowA isAboveRowAtIndexPath: rowB], @"Row %d,%d should be above %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertTrue( [rowA isAboveRowAtIndexPath: rowB], @"Row %ld,%ld should be above %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); } - (void) test_NSIndexPathIsBelowRowAtIndexPath { @@ -86,32 +86,32 @@ - (void) test_NSIndexPathIsBelowRowAtIndexPath { NSIndexPath *rowB; rowA = [NSIndexPath indexPathForRow: 1 inSection: 1]; - XCTAssertFalse( [rowA isBelowRowAtIndexPath: nil], @"Row %d,%d cannot be below nil", rowA.section, rowA.row ); + XCTAssertFalse( [rowA isBelowRowAtIndexPath: nil], @"Row %ld,%ld cannot be below nil", (long)rowA.section, (long)rowA.row ); rowB = [NSIndexPath indexPathForRow: 1 inSection: 1]; - XCTAssertFalse( [rowA isBelowRowAtIndexPath: rowB], @"Row %d,%d should not be below %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertFalse( [rowA isBelowRowAtIndexPath: rowB], @"Row %ld,%ld should not be below %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowB = [NSIndexPath indexPathForRow: 1 inSection: 0]; - XCTAssertTrue( [rowA isBelowRowAtIndexPath: rowB], @"Row %d,%d should be below %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertTrue( [rowA isBelowRowAtIndexPath: rowB], @"Row %ld,%ld should be below %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowB = [NSIndexPath indexPathForRow: 0 inSection: 1]; - XCTAssertTrue( [rowA isBelowRowAtIndexPath: rowB], @"Row %d,%d should be below %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertTrue( [rowA isBelowRowAtIndexPath: rowB], @"Row %ld,%ld should be below %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowB = [NSIndexPath indexPathForRow: 0 inSection: 0]; - XCTAssertTrue( [rowA isBelowRowAtIndexPath: rowB], @"Row %d,%d should be below %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertTrue( [rowA isBelowRowAtIndexPath: rowB], @"Row %ld,%ld should be below %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowA = [NSIndexPath indexPathForRow: 2 inSection: 3]; - XCTAssertFalse( [rowA isBelowRowAtIndexPath: nil], @"Row %d,%d cannot be below nil", rowA.section, rowA.row ); + XCTAssertFalse( [rowA isBelowRowAtIndexPath: nil], @"Row %ld,%ld cannot be below nil", (long)rowA.section, (long)rowA.row ); rowB = [NSIndexPath indexPathForRow: 2 inSection: 3]; - XCTAssertFalse( [rowA isBelowRowAtIndexPath: rowB], @"Row %d,%d should not be below %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertFalse( [rowA isBelowRowAtIndexPath: rowB], @"Row %ld,%ld should not be below %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowB = [NSIndexPath indexPathForRow: 3 inSection: 3]; - XCTAssertFalse( [rowA isBelowRowAtIndexPath: rowB], @"Row %d,%d should not be below %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertFalse( [rowA isBelowRowAtIndexPath: rowB], @"Row %ld,%ld should not be below %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowB = [NSIndexPath indexPathForRow: 0 inSection: 4]; - XCTAssertFalse( [rowA isBelowRowAtIndexPath: rowB], @"Row %d,%d should not be below %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertFalse( [rowA isBelowRowAtIndexPath: rowB], @"Row %ld,%ld should not be below %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowB = [NSIndexPath indexPathForRow: 2 inSection: 4]; - XCTAssertFalse( [rowA isBelowRowAtIndexPath: rowB], @"Row %d,%d should not be below %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertFalse( [rowA isBelowRowAtIndexPath: rowB], @"Row %ld,%ld should not be below %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowB = [NSIndexPath indexPathForRow: 3 inSection: 2]; - XCTAssertTrue( [rowA isBelowRowAtIndexPath: rowB], @"Row %d,%d should be below %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertTrue( [rowA isBelowRowAtIndexPath: rowB], @"Row %ld,%ld should be below %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowB = [NSIndexPath indexPathForRow: 0 inSection: 3]; - XCTAssertTrue( [rowA isBelowRowAtIndexPath: rowB], @"Row %d,%d should be below %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertTrue( [rowA isBelowRowAtIndexPath: rowB], @"Row %ld,%ld should be below %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); rowB = [NSIndexPath indexPathForRow: 0 inSection: 0]; - XCTAssertTrue( [rowA isBelowRowAtIndexPath: rowB], @"Row %d,%d should be below %d,%d", rowA.section, rowA.row, rowB.section, rowB.row ); + XCTAssertTrue( [rowA isBelowRowAtIndexPath: rowB], @"Row %ld,%ld should be below %ld,%ld", (long)rowA.section, (long)rowA.row, (long)rowB.section, (long)rowB.row ); } //------------------------------------------------------------------------------