|
9 | 9 |
|
10 | 10 | class TestIndexPath: XCTestCase {
|
11 | 11 |
|
12 |
| - static var allTests: [(String, (TestIndexPath) -> () throws -> Void)] { |
13 |
| - return [ |
14 |
| - ("testEmpty", testEmpty), |
15 |
| - ("testSingleIndex", testSingleIndex), |
16 |
| - ("testTwoIndexes", testTwoIndexes), |
17 |
| - ("testManyIndexes", testManyIndexes), |
18 |
| - ("testCreateFromSequence", testCreateFromSequence), |
19 |
| - ("testCreateFromLiteral", testCreateFromLiteral), |
20 |
| - ("testDropLast", testDropLast), |
21 |
| - ("testDropLastFromEmpty", testDropLastFromEmpty), |
22 |
| - ("testDropLastFromSingle", testDropLastFromSingle), |
23 |
| - ("testDropLastFromPair", testDropLastFromPair), |
24 |
| - ("testDropLastFromTriple", testDropLastFromTriple), |
25 |
| - ("testStartEndIndex", testStartEndIndex), |
26 |
| - ("testIterator", testIterator), |
27 |
| - ("testIndexing", testIndexing), |
28 |
| - ("testCompare", testCompare), |
29 |
| - ("testHashing", testHashing), |
30 |
| - ("testEquality", testEquality), |
31 |
| - ("testSubscripting", testSubscripting), |
32 |
| - ("testAppending", testAppending), |
33 |
| - ("testAppendEmpty", testAppendEmpty), |
34 |
| - ("testAppendEmptyIndexPath", testAppendEmptyIndexPath), |
35 |
| - ("testAppendManyIndexPath", testAppendManyIndexPath), |
36 |
| - ("testAppendEmptyIndexPathToSingle", testAppendEmptyIndexPathToSingle), |
37 |
| - ("testAppendSingleIndexPath", testAppendSingleIndexPath), |
38 |
| - ("testAppendSingleIndexPathToSingle", testAppendSingleIndexPathToSingle), |
39 |
| - ("testAppendPairIndexPath", testAppendPairIndexPath), |
40 |
| - ("testAppendManyIndexPathToEmpty", testAppendManyIndexPathToEmpty), |
41 |
| - ("testAppendByOperator", testAppendByOperator), |
42 |
| - ("testAppendArray", testAppendArray), |
43 |
| - ("testRanges", testRanges), |
44 |
| - ("testRangeFromEmpty", testRangeFromEmpty), |
45 |
| - ("testRangeFromSingle", testRangeFromSingle), |
46 |
| - ("testRangeFromPair", testRangeFromPair), |
47 |
| - ("testRangeFromMany", testRangeFromMany), |
48 |
| - ("testRangeReplacementSingle", testRangeReplacementSingle), |
49 |
| - ("testRangeReplacementPair", testRangeReplacementPair), |
50 |
| - ("testMoreRanges", testMoreRanges), |
51 |
| - ("testIteration", testIteration), |
52 |
| - ("testDescription", testDescription), |
53 |
| - ("testBridgeToObjC", testBridgeToObjC), |
54 |
| - ("testForceBridgeFromObjC", testForceBridgeFromObjC), |
55 |
| - ("testConditionalBridgeFromObjC", testConditionalBridgeFromObjC), |
56 |
| - ("testUnconditionalBridgeFromObjC", testUnconditionalBridgeFromObjC), |
57 |
| - ("testObjcBridgeType", testObjcBridgeType), |
58 |
| - ("test_AnyHashableContainingIndexPath", test_AnyHashableContainingIndexPath), |
59 |
| - ("test_AnyHashableCreatedFromNSIndexPath", test_AnyHashableCreatedFromNSIndexPath), |
60 |
| - ("test_unconditionallyBridgeFromObjectiveC", test_unconditionallyBridgeFromObjectiveC), |
61 |
| - ("test_slice_1ary", test_slice_1ary), |
62 |
| - ("test_copy", test_copy), |
63 |
| - ] |
64 |
| - } |
65 |
| - |
66 | 12 | func testEmpty() {
|
67 | 13 | let ip = IndexPath()
|
68 | 14 | XCTAssertEqual(ip.count, 0)
|
@@ -790,4 +736,79 @@ class TestIndexPath: XCTestCase {
|
790 | 736 | XCTAssertEqual(nip2.length, 3)
|
791 | 737 | XCTAssertEqual(nip1, nip2)
|
792 | 738 | }
|
| 739 | + |
| 740 | + let fixtures: [TypedFixture<NSIndexPath>] = [ |
| 741 | + Fixtures.indexPathEmpty, |
| 742 | + Fixtures.indexPathOneIndex, |
| 743 | + Fixtures.indexPathManyIndices, |
| 744 | + ] |
| 745 | + |
| 746 | + func testCodingRoundtrip() throws { |
| 747 | + for fixture in fixtures { |
| 748 | + try fixture.assertValueRoundtripsInCoder() |
| 749 | + } |
| 750 | + } |
| 751 | + |
| 752 | + func testLoadedValuesMatch() throws { |
| 753 | + for fixture in fixtures { |
| 754 | + try fixture.assertLoadedValuesMatch() |
| 755 | + } |
| 756 | + } |
| 757 | + |
| 758 | + static var allTests: [(String, (TestIndexPath) -> () throws -> Void)] { |
| 759 | + return [ |
| 760 | + ("testEmpty", testEmpty), |
| 761 | + ("testSingleIndex", testSingleIndex), |
| 762 | + ("testTwoIndexes", testTwoIndexes), |
| 763 | + ("testManyIndexes", testManyIndexes), |
| 764 | + ("testCreateFromSequence", testCreateFromSequence), |
| 765 | + ("testCreateFromLiteral", testCreateFromLiteral), |
| 766 | + ("testDropLast", testDropLast), |
| 767 | + ("testDropLastFromEmpty", testDropLastFromEmpty), |
| 768 | + ("testDropLastFromSingle", testDropLastFromSingle), |
| 769 | + ("testDropLastFromPair", testDropLastFromPair), |
| 770 | + ("testDropLastFromTriple", testDropLastFromTriple), |
| 771 | + ("testStartEndIndex", testStartEndIndex), |
| 772 | + ("testIterator", testIterator), |
| 773 | + ("testIndexing", testIndexing), |
| 774 | + ("testCompare", testCompare), |
| 775 | + ("testHashing", testHashing), |
| 776 | + ("testEquality", testEquality), |
| 777 | + ("testSubscripting", testSubscripting), |
| 778 | + ("testAppending", testAppending), |
| 779 | + ("testAppendEmpty", testAppendEmpty), |
| 780 | + ("testAppendEmptyIndexPath", testAppendEmptyIndexPath), |
| 781 | + ("testAppendManyIndexPath", testAppendManyIndexPath), |
| 782 | + ("testAppendEmptyIndexPathToSingle", testAppendEmptyIndexPathToSingle), |
| 783 | + ("testAppendSingleIndexPath", testAppendSingleIndexPath), |
| 784 | + ("testAppendSingleIndexPathToSingle", testAppendSingleIndexPathToSingle), |
| 785 | + ("testAppendPairIndexPath", testAppendPairIndexPath), |
| 786 | + ("testAppendManyIndexPathToEmpty", testAppendManyIndexPathToEmpty), |
| 787 | + ("testAppendByOperator", testAppendByOperator), |
| 788 | + ("testAppendArray", testAppendArray), |
| 789 | + ("testRanges", testRanges), |
| 790 | + ("testRangeFromEmpty", testRangeFromEmpty), |
| 791 | + ("testRangeFromSingle", testRangeFromSingle), |
| 792 | + ("testRangeFromPair", testRangeFromPair), |
| 793 | + ("testRangeFromMany", testRangeFromMany), |
| 794 | + ("testRangeReplacementSingle", testRangeReplacementSingle), |
| 795 | + ("testRangeReplacementPair", testRangeReplacementPair), |
| 796 | + ("testMoreRanges", testMoreRanges), |
| 797 | + ("testIteration", testIteration), |
| 798 | + ("testDescription", testDescription), |
| 799 | + ("testBridgeToObjC", testBridgeToObjC), |
| 800 | + ("testForceBridgeFromObjC", testForceBridgeFromObjC), |
| 801 | + ("testConditionalBridgeFromObjC", testConditionalBridgeFromObjC), |
| 802 | + ("testUnconditionalBridgeFromObjC", testUnconditionalBridgeFromObjC), |
| 803 | + ("testObjcBridgeType", testObjcBridgeType), |
| 804 | + ("test_AnyHashableContainingIndexPath", test_AnyHashableContainingIndexPath), |
| 805 | + ("test_AnyHashableCreatedFromNSIndexPath", test_AnyHashableCreatedFromNSIndexPath), |
| 806 | + ("test_unconditionallyBridgeFromObjectiveC", test_unconditionallyBridgeFromObjectiveC), |
| 807 | + ("test_slice_1ary", test_slice_1ary), |
| 808 | + ("test_copy", test_copy), |
| 809 | + ("testCodingRoundtrip", testCodingRoundtrip), |
| 810 | + ("testLoadedValuesMatch", testLoadedValuesMatch), |
| 811 | + ] |
| 812 | + } |
| 813 | + |
793 | 814 | }
|
0 commit comments