Skip to content

Commit 536af26

Browse files
committed
Cleanup: AIGraphReducerTest>>#mergedNodesIn: should use isNotNil
Fix #37 and pharo-project/pharo#15483
1 parent 876fd9c commit 536af26

28 files changed

+291
-238
lines changed

src/AI-Algorithms-Graph-Tests/AIAstarTest.class.st

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
Class {
2-
#name : #AIAstarTest,
3-
#superclass : #TestCase,
2+
#name : 'AIAstarTest',
3+
#superclass : 'TestCase',
44
#instVars : [
55
'astar'
66
],
7-
#category : #'AI-Algorithms-Graph-Tests-Tests'
7+
#category : 'AI-Algorithms-Graph-Tests-Tests',
8+
#package : 'AI-Algorithms-Graph-Tests',
9+
#tag : 'Tests'
810
}
911

10-
{ #category : #running }
12+
{ #category : 'running' }
1113
AIAstarTest >> setUp [
1214
super setUp.
1315
astar := AIAstar new
1416
]
1517

16-
{ #category : #tests }
18+
{ #category : 'tests' }
1719
AIAstarTest >> testAseBasicCircuit [
1820

1921
|graphType graph |
@@ -39,7 +41,7 @@ AIAstarTest >> testAseBasicCircuit [
3941
self assert: Float infinity equals: (astar findNode: $a) pathDistance
4042
]
4143

42-
{ #category : #tests }
44+
{ #category : 'tests' }
4345
AIAstarTest >> testAseBasicCircuitBacktrack [
4446

4547
|graphType graph |
@@ -73,7 +75,7 @@ AIAstarTest >> testAseBasicCircuitBacktrack [
7375
reconstructPath))
7476
]
7577

76-
{ #category : #tests }
78+
{ #category : 'tests' }
7779
AIAstarTest >> testComplexWeightedGraph2 [
7880

7981

@@ -95,7 +97,7 @@ AIAstarTest >> testComplexWeightedGraph2 [
9597
self assert: (astar findNode: 5) pathDistance equals: 10
9698
]
9799

98-
{ #category : #tests }
100+
{ #category : 'tests' }
99101
AIAstarTest >> testComplexWeightedGraph2BackTracking [
100102

101103
| shortestPath graphType graph |
@@ -138,7 +140,7 @@ AIAstarTest >> testComplexWeightedGraph2BackTracking [
138140
astar reset
139141
]
140142

141-
{ #category : #tests }
143+
{ #category : 'tests' }
142144
AIAstarTest >> testComplexWeightedGraph3 [
143145

144146
|graphType graph |
@@ -158,7 +160,7 @@ AIAstarTest >> testComplexWeightedGraph3 [
158160
self assert: (astar findNode: $e) pathDistance equals: 2
159161
]
160162

161-
{ #category : #tests }
163+
{ #category : 'tests' }
162164
AIAstarTest >> testComplexWeightedGraph3Backtracking [
163165

164166
| shortestPath graphType graph |
@@ -195,7 +197,7 @@ AIAstarTest >> testComplexWeightedGraph3Backtracking [
195197
astar reset
196198
]
197199

198-
{ #category : #tests }
200+
{ #category : 'tests' }
199201
AIAstarTest >> testSimpleWeightedGraph [
200202

201203
|graphType graph |
@@ -215,7 +217,7 @@ AIAstarTest >> testSimpleWeightedGraph [
215217
self assert: (astar findNode: 5) pathDistance equals: 3
216218
]
217219

218-
{ #category : #tests }
220+
{ #category : 'tests' }
219221
AIAstarTest >> testSimpleWeightedGraphBacktracking [
220222

221223
| shortestPath graphType graph |

src/AI-Algorithms-Graph-Tests/AIBFSTest.class.st

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
Class {
2-
#name : #AIBFSTest,
3-
#superclass : #TestCase,
2+
#name : 'AIBFSTest',
3+
#superclass : 'TestCase',
44
#instVars : [
55
'bfsp'
66
],
7-
#category : #'AI-Algorithms-Graph-Tests-Tests'
7+
#category : 'AI-Algorithms-Graph-Tests-Tests',
8+
#package : 'AI-Algorithms-Graph-Tests',
9+
#tag : 'Tests'
810
}
911

10-
{ #category : #running }
12+
{ #category : 'running' }
1113
AIBFSTest >> setUp [
1214
super setUp.
1315
bfsp := AIBFS new
1416
]
1517

16-
{ #category : #tests }
18+
{ #category : 'tests' }
1719
AIBFSTest >> testAseGraph [
1820

1921
|graph graphType|
@@ -32,7 +34,7 @@ AIBFSTest >> testAseGraph [
3234
self assert: (#() hasEqualElements: (bfsp runFrom: $f to: $a))
3335
]
3436

35-
{ #category : #tests }
37+
{ #category : 'tests' }
3638
AIBFSTest >> testAseSccGraph [
3739

3840
|graph graphType|
@@ -45,7 +47,7 @@ AIBFSTest >> testAseSccGraph [
4547
self assert: (#( $a $b $d ) hasEqualElements: (bfsp runFrom: $a to: $d))
4648
]
4749

48-
{ #category : #tests }
50+
{ #category : 'tests' }
4951
AIBFSTest >> testComplexUndirectedGraph [
5052

5153
|graph graphType|
@@ -62,7 +64,7 @@ AIBFSTest >> testComplexUndirectedGraph [
6264
self assert: (#( 4 3 2 12 9 ) hasEqualElements: (bfsp runFrom: 4 to: 9))
6365
]
6466

65-
{ #category : #tests }
67+
{ #category : 'tests' }
6668
AIBFSTest >> testSimpleGraph [
6769

6870
|graph graphType|
@@ -74,7 +76,7 @@ AIBFSTest >> testSimpleGraph [
7476
self assert: (#( $d $c ) hasEqualElements: (bfsp runFrom: $d to: $c))
7577
]
7678

77-
{ #category : #tests }
79+
{ #category : 'tests' }
7880
AIBFSTest >> testWithoutCyclesComplexGraph [
7981

8082
|graph graphType|

src/AI-Algorithms-Graph-Tests/AIBellmanFordTest.class.st

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@
22
An AIBellmanFordTest is a test class for testing the behavior of AIBellmanFord
33
"
44
Class {
5-
#name : #AIBellmanFordTest,
6-
#superclass : #TestCase,
5+
#name : 'AIBellmanFordTest',
6+
#superclass : 'TestCase',
77
#instVars : [
88
'bellmanFord'
99
],
10-
#category : #'AI-Algorithms-Graph-Tests-Shortest path'
10+
#category : 'AI-Algorithms-Graph-Tests-Shortest path',
11+
#package : 'AI-Algorithms-Graph-Tests',
12+
#tag : 'Shortest path'
1113
}
1214

13-
{ #category : #running }
15+
{ #category : 'running' }
1416
AIBellmanFordTest >> setUp [
1517
super setUp.
1618
bellmanFord := AIBellmanFord new
1719
]
1820

19-
{ #category : #tests }
21+
{ #category : 'tests' }
2022
AIBellmanFordTest >> testNegativeUnconnectedWeightedGraph [
2123

2224
|graphType graph |
@@ -44,7 +46,7 @@ AIBellmanFordTest >> testNegativeUnconnectedWeightedGraph [
4446
self assert: (bellmanFord findNode: 9) pathDistance equals: Float negativeInfinity
4547
]
4648

47-
{ #category : #tests }
49+
{ #category : 'tests' }
4850
AIBellmanFordTest >> testNegativeWeightedGraph [
4951

5052
|graphType graph |
@@ -71,7 +73,7 @@ AIBellmanFordTest >> testNegativeWeightedGraph [
7173
self assert: (bellmanFord findNode: 9) pathDistance equals: Float negativeInfinity
7274
]
7375

74-
{ #category : #tests }
76+
{ #category : 'tests' }
7577
AIBellmanFordTest >> testNegativeWeightedGraph2 [
7678

7779
|graphType graph |
@@ -99,7 +101,7 @@ AIBellmanFordTest >> testNegativeWeightedGraph2 [
99101
self assert: (bellmanFord findNode: 9) pathDistance equals: Float negativeInfinity
100102
]
101103

102-
{ #category : #tests }
104+
{ #category : 'tests' }
103105
AIBellmanFordTest >> testNegativeWeightedGraphReconstrucPath [
104106

105107
|graphType graph |

src/AI-Algorithms-Graph-Tests/AICyclicNonWeightedComplexFixture.class.st

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@ Graph Class:
66
4. Complex Graphs
77
"
88
Class {
9-
#name : #AICyclicNonWeightedComplexFixture,
10-
#superclass : #Object,
9+
#name : 'AICyclicNonWeightedComplexFixture',
10+
#superclass : 'Object',
1111
#instVars : [
1212
'complexCycleGraph',
1313
'complexCycleGraph2',
1414
'complexUndirectedGraph',
1515
'stronglyConnectedGraph',
1616
'stronglyConnectedGraphWithObjects'
1717
],
18-
#category : #'AI-Algorithms-Graph-Tests-Fixture'
18+
#category : 'AI-Algorithms-Graph-Tests-Fixture',
19+
#package : 'AI-Algorithms-Graph-Tests',
20+
#tag : 'Fixture'
1921
}
2022

21-
{ #category : #fixtures }
23+
{ #category : 'fixtures' }
2224
AICyclicNonWeightedComplexFixture >> complexCycleGraph [
2325

2426
"https://i.imgur.com/4trPCcb.jpeg"
@@ -35,7 +37,7 @@ AICyclicNonWeightedComplexFixture >> complexCycleGraph [
3537
^graph
3638
]
3739

38-
{ #category : #fixtures }
40+
{ #category : 'fixtures' }
3941
AICyclicNonWeightedComplexFixture >> complexCycleGraph2 [
4042
| nodes edges graph|
4143
nodes := $a to: $i.
@@ -52,7 +54,7 @@ AICyclicNonWeightedComplexFixture >> complexCycleGraph2 [
5254
^graph
5355
]
5456

55-
{ #category : #fixtures }
57+
{ #category : 'fixtures' }
5658
AICyclicNonWeightedComplexFixture >> complexUndirectedGraph [
5759

5860
"https://i.imgur.com/qK2zsYb.png"
@@ -72,7 +74,7 @@ AICyclicNonWeightedComplexFixture >> complexUndirectedGraph [
7274
^graph
7375
]
7476

75-
{ #category : #initialization }
77+
{ #category : 'initialization' }
7678
AICyclicNonWeightedComplexFixture >> initialize [
7779
|persons|
7880
super initialize .
@@ -84,7 +86,7 @@ AICyclicNonWeightedComplexFixture >> initialize [
8486
stronglyConnectedGraphWithObjects := self stronglyConnectedGraph: persons.
8587
]
8688

87-
{ #category : #fixtures }
89+
{ #category : 'fixtures' }
8890
AICyclicNonWeightedComplexFixture >> stronglyConnectedGraph [
8991

9092
"This a graph for 4 strongly connected components "
@@ -102,7 +104,7 @@ AICyclicNonWeightedComplexFixture >> stronglyConnectedGraph [
102104
^graph
103105
]
104106

105-
{ #category : #fixtures }
107+
{ #category : 'fixtures' }
106108
AICyclicNonWeightedComplexFixture >> stronglyConnectedGraph: objects [
107109

108110
"This is the exact same graph as #stronglyConnectedGraph: but using a custom object"
@@ -122,7 +124,7 @@ AICyclicNonWeightedComplexFixture >> stronglyConnectedGraph: objects [
122124
^graph
123125
]
124126

125-
{ #category : #fixtures }
127+
{ #category : 'fixtures' }
126128
AICyclicNonWeightedComplexFixture >> stronglyConnectedGraph: graphBuilder withObjects: objects [
127129

128130
"This is the exact same graph as #stronglyConnectedGraph: but using a custom object"

src/AI-Algorithms-Graph-Tests/AICyclicNonWeightedSimpleFixture.class.st

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Graph Class:
66
4. Simple Graphs
77
"
88
Class {
9-
#name : #AICyclicNonWeightedSimpleFixture,
10-
#superclass : #Object,
9+
#name : 'AICyclicNonWeightedSimpleFixture',
10+
#superclass : 'Object',
1111
#instVars : [
1212
'aseCircuitGraph',
1313
'aseSccGraph',
@@ -17,10 +17,12 @@ Class {
1717
'nestedCycleGraph',
1818
'simpleGraphForHits'
1919
],
20-
#category : #'AI-Algorithms-Graph-Tests-Fixture'
20+
#category : 'AI-Algorithms-Graph-Tests-Fixture',
21+
#package : 'AI-Algorithms-Graph-Tests',
22+
#tag : 'Fixture'
2123
}
2224

23-
{ #category : #fixtures }
25+
{ #category : 'fixtures' }
2426
AICyclicNonWeightedSimpleFixture >> aseCircuitGraph [
2527

2628
"https://i.imgur.com/t1S6dG4.jpeg"
@@ -37,7 +39,7 @@ AICyclicNonWeightedSimpleFixture >> aseCircuitGraph [
3739
^graph
3840
]
3941

40-
{ #category : #fixtures }
42+
{ #category : 'fixtures' }
4143
AICyclicNonWeightedSimpleFixture >> aseSccGraph [
4244

4345
| nodes edges graph|
@@ -50,7 +52,7 @@ AICyclicNonWeightedSimpleFixture >> aseSccGraph [
5052
^graph
5153
]
5254

53-
{ #category : #fixtures }
55+
{ #category : 'fixtures' }
5456
AICyclicNonWeightedSimpleFixture >> cycleGraph [
5557

5658
"https://i.imgur.com/MNtwA56.jpeg"
@@ -65,7 +67,7 @@ AICyclicNonWeightedSimpleFixture >> cycleGraph [
6567
^graph
6668
]
6769

68-
{ #category : #fixtures }
70+
{ #category : 'fixtures' }
6971
AICyclicNonWeightedSimpleFixture >> dependencyGraph [
7072

7173
| nodes edges graph|
@@ -80,7 +82,7 @@ AICyclicNonWeightedSimpleFixture >> dependencyGraph [
8082
^graph
8183
]
8284

83-
{ #category : #initialization }
85+
{ #category : 'initialization' }
8486
AICyclicNonWeightedSimpleFixture >> initialize [
8587
super initialize .
8688
aseCircuitGraph := self aseCircuitGraph .
@@ -92,7 +94,7 @@ AICyclicNonWeightedSimpleFixture >> initialize [
9294
simpleGraphForHits := self simpleGraphForHits .
9395
]
9496

95-
{ #category : #fixtures }
97+
{ #category : 'fixtures' }
9698
AICyclicNonWeightedSimpleFixture >> moduleGraph [
9799

98100
| nodes edges graph |
@@ -114,7 +116,7 @@ AICyclicNonWeightedSimpleFixture >> moduleGraph [
114116
^graph
115117
]
116118

117-
{ #category : #fixtures }
119+
{ #category : 'fixtures' }
118120
AICyclicNonWeightedSimpleFixture >> nestedCycleGraph [
119121

120122
"https://i.imgur.com/6lk0pmR.jpeg"
@@ -131,7 +133,7 @@ AICyclicNonWeightedSimpleFixture >> nestedCycleGraph [
131133
^graph
132134
]
133135

134-
{ #category : #fixtures }
136+
{ #category : 'fixtures' }
135137
AICyclicNonWeightedSimpleFixture >> simpleGraphForHits [
136138

137139
"https://i.imgur.com/FvqrFbf.png"

0 commit comments

Comments
 (0)