Skip to content

Commit ddc4459

Browse files
authored
Merge pull request #50 from pankaj-bind/AIEuclideanDistanceTest
Add Missing Tests for AIEuclideanDistanceTest
2 parents 8a84c9b + 0582831 commit ddc4459

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,31 @@ AIEuclideanDistanceTest >> testEuclideanDistanceTwoDimensions [
4040
assert: (metric distanceBetween: #( 0 1 ) and: #( 1 0))
4141
closeTo: 2 sqrt
4242
]
43+
44+
{ #category : '*AI-EditDistances-Tests' }
45+
AIEuclideanDistanceTest >> testEmptyCollections [
46+
47+
"Tests that the Euclidean distance between two empty collections is 0."
48+
self assert: (metric distanceBetween: #() and: #()) equals: 0.
49+
]
50+
51+
{ #category : '*AI-EditDistances-Tests' }
52+
AIEuclideanDistanceTest >> testIdenticalCollections [
53+
54+
"Tests that the Euclidean distance between identical collections is 0."
55+
self assert: (metric distanceBetween: #(1 2 3) and: #(1 2 3)) equals: 0.
56+
]
57+
58+
{ #category : '*AI-EditDistances-Tests' }
59+
AIEuclideanDistanceTest >> testDifferentLengths [
60+
61+
"Tests that an error is raised for collections of different lengths."
62+
self should: [ metric distanceBetween: #(1 2) and: #(1 2 3) ] raise: Error.
63+
]
64+
65+
{ #category : '*AI-EditDistances-Tests' }
66+
AIEuclideanDistanceTest >> testNonNumericInputs [
67+
68+
"Tests that an error is raised for non-numeric inputs."
69+
self should: [ metric distanceBetween: #(1 'a' 3) and: #(1 2 3) ] raise: Error.
70+
]

0 commit comments

Comments
 (0)