File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
src/AI-EditDistances-Tests Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -13,3 +13,39 @@ AIManhattanDistanceTest >> testManhattanDistanceTo [
1313
1414 self assert: (metric distanceBetween: #( 10 20 10 ) and : #( 10 20 20 ) ) equals: 10
1515]
16+
17+ { #category : ' tests' }
18+ AIManhattanDistanceTest >> testEmptyCollections [
19+ " Checks that the Manhattan distance between empty collections is 0."
20+
21+ | metric |
22+ metric := AIManhattanDistance new .
23+ self assert: (metric distanceBetween: #() and : #() ) equals: 0
24+ ]
25+
26+ { #category : ' tests' }
27+ AIManhattanDistanceTest >> testIdenticalCollections [
28+ " Checks that the Manhattan distance between identical collections is 0."
29+
30+ | metric |
31+ metric := AIManhattanDistance new .
32+ self assert: (metric distanceBetween: #(1 2 3) and : #(1 2 3) ) equals: 0
33+ ]
34+
35+ { #category : ' tests' }
36+ AIManhattanDistanceTest >> testNegativeNumbers [
37+ " Checks Manhattan distance with negative numbers."
38+
39+ | metric |
40+ metric := AIManhattanDistance new .
41+ self assert: (metric distanceBetween: #(-1 2 -3) and : #(1 -2 3) ) equals: 12
42+ ]
43+
44+ { #category : ' tests' }
45+ AIManhattanDistanceTest >> testFloatingPointNumbers [
46+ " Checks Manhattan distance with floating-point numbers."
47+
48+ | metric |
49+ metric := AIManhattanDistance new .
50+ self assert: (metric distanceBetween: #(1.5 2.5) and : #(0.5 0.5) ) equals: 3.0
51+ ]
You can’t perform that action at this time.
0 commit comments