Skip to content

Commit b5c49cb

Browse files
authored
Merge pull request #51 from pankaj-bind/AIManhattanDistance-Test
Add Missing Tests for AIManhattanDistanceTest
2 parents ddc4459 + e19464a commit b5c49cb

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/AI-EditDistances-Tests/AIManhattanDistanceTest.class.st

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
]

0 commit comments

Comments
 (0)