Skip to content

Commit a9a955e

Browse files
refactor/test: removed a comment, and added a missing test.
1 parent 9aaedf0 commit a9a955e

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/Math-Complex/PMComplexNumber.class.st

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,9 +626,9 @@ PMComplexNumber >> raisedTo: index [
626626

627627
index isInteger ifTrue: [ ^ self raisedToInteger: index ].
628628

629-
0 = index ifTrue: [ ^ self class one ]. "Special case of exponent=0"
630-
1 = index ifTrue: [ ^ self ]. "Special case of exponent=1"
631-
0 = self ifTrue: [ "Special case of self = 0"
629+
0 = index ifTrue: [ ^ self class one ].
630+
1 = index ifTrue: [ ^ self ].
631+
0 = self ifTrue: [
632632
^ index < 0
633633
ifTrue: [ (ZeroDivide dividend: self) signal ]
634634
ifFalse: [ self ] ].

src/Math-Tests-Complex/PMComplexNumberTest.class.st

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,13 @@ PMComplexNumberTest >> testRaisedToPositiveInteger [
670670
self assert: zCubed closeTo: (0 + 1 i).
671671
]
672672

673+
{ #category : #'testing - mathematical functions' }
674+
PMComplexNumberTest >> testRaisingZeroToThePowerOfNegativeIndex [
675+
| zero |
676+
zero := PMComplexNumber zero.
677+
self should: [ zero raisedTo: -4 ] raise: ZeroDivide
678+
]
679+
673680
{ #category : #tests }
674681
PMComplexNumberTest >> testRandom [
675682
| random c r |

0 commit comments

Comments
 (0)