@@ -19,100 +19,92 @@ class Test_RecursionDetector_Generic: Test_Core {
1919
2020 func testEmpty( ) throws { try _test ( rootNodes: [ ] , putIntoContainer: [ ] , expected: [ ] ) }
2121
22- func testSingleNode( ) throws { try _test ( rootNodes: [ " A " ] , putIntoContainer: [ " A - > " ] , expected: [ ] ) }
22+ func testSingleNode( ) throws { try _test ( rootNodes: [ " A " ] , putIntoContainer: [ " A > " ] , expected: [ ] ) }
2323
2424 func testMultipleNodesNoEdges( ) throws {
25- try _test ( rootNodes: [ " A " , " B " , " C " ] , putIntoContainer: [ " A - > " , " B - > " , " C - > " ] , expected: [ ] )
25+ try _test ( rootNodes: [ " A " , " B " , " C " ] , putIntoContainer: [ " A > " , " B > " , " C > " ] , expected: [ ] )
2626 }
2727
2828 func testNoCycle( ) throws {
29- try _test (
30- rootNodes: [ " A " , " B " , " C " , " D " ] ,
31- putIntoContainer: [ " A -> B " , " B -> C " , " C -> D " , " D -> " ] ,
32- expected: [ ]
33- )
29+ try _test ( rootNodes: [ " A " , " B " , " C " , " D " ] , putIntoContainer: [ " A > B " , " B > C " , " C > D " , " D > " ] , expected: [ ] )
3430 }
3531
3632 func testNoCycleAndDoubleEdge( ) throws {
3733 try _test (
3834 rootNodes: [ " A " , " B " , " C " , " D " ] ,
39- putIntoContainer: [ " A - > B " , " B - > C,D " , " C - > D " , " D - > " ] ,
35+ putIntoContainer: [ " A > B " , " B > C,D " , " C > D " , " D > " ] ,
4036 expected: [ ]
4137 )
4238 }
4339
44- func testSelfLoop( ) throws { try _test ( rootNodes: [ " A " ] , putIntoContainer: [ " A - > A " ] , expected: [ " A " ] ) }
40+ func testSelfLoop( ) throws { try _test ( rootNodes: [ " A " ] , putIntoContainer: [ " A > A " ] , expected: [ " A " ] ) }
4541
4642 func testSimpleCycle( ) throws {
47- try _test ( rootNodes: [ " A " , " B " ] , putIntoContainer: [ " A - > B " , " B - > A " ] , expected: [ " A " ] )
43+ try _test ( rootNodes: [ " A " , " B " ] , putIntoContainer: [ " A > B " , " B > A " ] , expected: [ " A " ] )
4844 }
4945
5046 func testLongerCycleStartA( ) throws {
51- try _test ( rootNodes: [ " A " , " C " , " B " ] , putIntoContainer: [ " A - > B " , " B - > C " , " C - > A " ] , expected: [ " A " ] )
47+ try _test ( rootNodes: [ " A " , " C " , " B " ] , putIntoContainer: [ " A > B " , " B > C " , " C > A " ] , expected: [ " A " ] )
5248 }
5349
5450 func testLongerCycleStartC( ) throws {
55- try _test ( rootNodes: [ " C " , " A " , " B " ] , putIntoContainer: [ " A - > B " , " B - > C " , " C - > A " ] , expected: [ " C " ] )
51+ try _test ( rootNodes: [ " C " , " A " , " B " ] , putIntoContainer: [ " A > B " , " B > C " , " C > A " ] , expected: [ " C " ] )
5652 }
5753
5854 func testLongerCycleStartAButNotBoxable( ) throws {
59- try _test ( rootNodes: [ " A " , " C " , " B " ] , putIntoContainer: [ " A! - > B " , " B - > C " , " C - > A " ] , expected: [ " B " ] )
55+ try _test ( rootNodes: [ " A " , " C " , " B " ] , putIntoContainer: [ " A! > B " , " B > C " , " C > A " ] , expected: [ " B " ] )
6056 }
6157
6258 func testMultipleCycles( ) throws {
6359 try _test (
6460 rootNodes: [ " A " , " C " , " B " , " D " ] ,
65- putIntoContainer: [ " A - > B " , " B - > A " , " C - > D " , " D - > C " ] ,
61+ putIntoContainer: [ " A > B " , " B > A " , " C > D " , " D > C " ] ,
6662 expected: [ " A " , " C " ]
6763 )
6864 }
6965
7066 func testMultipleCyclesOverlapping( ) throws {
7167 try _test (
7268 rootNodes: [ " C " , " A " , " B " , " D " ] ,
73- putIntoContainer: [ " A - > B " , " B - > C " , " C - > A,D " , " D - > C " ] ,
69+ putIntoContainer: [ " A > B " , " B > C " , " C > A,D " , " D > C " ] ,
7470 expected: [ " C " ]
7571 )
7672 }
7773
7874 func testMultipleCycles3( ) throws {
7975 try _test (
8076 rootNodes: [ " A " , " B " , " C " , " D " ] ,
81- putIntoContainer: [ " A - > C " , " B - > D,A " , " C - > B,D " , " D - > B,C " ] ,
77+ putIntoContainer: [ " A > C " , " B > D,A " , " C > B,D " , " D > B,C " ] ,
8278 expected: [ " A " , " B " , " C " ]
8379 )
8480 }
8581
8682 func testNested( ) throws {
8783 try _test (
8884 rootNodes: [ " A " , " C " , " B " , " D " ] ,
89- putIntoContainer: [ " A - > B " , " B - > C " , " C - > B,D " , " D - > C " ] ,
85+ putIntoContainer: [ " A > B " , " B > C " , " C > B,D " , " D > C " ] ,
9086 expected: [ " B " , " C " ]
9187 )
9288 }
9389
9490 func testDisconnected( ) throws {
9591 try _test (
9692 rootNodes: [ " A " , " C " , " B " , " D " ] ,
97- putIntoContainer: [ " A - > B " , " B - > A " , " C - > D " , " D - > " ] ,
93+ putIntoContainer: [ " A > B " , " B > A " , " C > D " , " D > " ] ,
9894 expected: [ " A " ]
9995 )
10096 }
10197
10298 func testCycleWithLeadingNode( ) throws {
10399 try _test (
104100 rootNodes: [ " A " , " B " , " C " , " D " ] ,
105- putIntoContainer: [ " A - > B " , " B - > C " , " C - > D " , " D - > B " ] ,
101+ putIntoContainer: [ " A > B " , " B > C " , " C > D " , " D > B " ] ,
106102 expected: [ " B " ]
107103 )
108104 }
109105
110106 func testDifferentCyclesForSameNode( ) throws {
111- try _test (
112- rootNodes: [ " C " , " A " , " B " ] ,
113- putIntoContainer: [ " A -> B " , " B -> C,A " , " C -> A " ] ,
114- expected: [ " C " , " A " ]
115- )
107+ try _test ( rootNodes: [ " C " , " A " , " B " ] , putIntoContainer: [ " A > B " , " B > C,A " , " C > A " ] , expected: [ " C " , " A " ] )
116108 }
117109
118110 // MARK: - Private
@@ -147,9 +139,9 @@ private struct TestNode: TypeNode, ExpressibleByStringLiteral {
147139 }
148140
149141 init ( stringLiteral value: StringLiteralType ) {
150- // A - > B,C,D for boxable
151- // A! - > B,C,D for unboxable
152- let comps = value. split ( separator: " - >" , omittingEmptySubsequences: false )
142+ // A > B,C,D for boxable
143+ // A! > B,C,D for unboxable
144+ let comps = value. split ( separator: " > " , omittingEmptySubsequences: false )
153145 . map { $0. trimmingCharacters ( in: . whitespaces) }
154146 precondition ( comps. count == 2 , " Invalid syntax " )
155147 let edges = comps [ 1 ] . split ( separator: " , " ) . map ( String . init)
0 commit comments