File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -626,6 +626,30 @@ PMComplexTest >> testSquareRootOfANegativeRealNumberIsPureImaginary [
626626 self assert: squareRoot equals: 2 i.
627627]
628628
629+ { #category : #tests }
630+ PMComplexTest >> testSquareRootOfPositiveRealNumberIsAComplexNumberWithOnlyARealPart [
631+
632+ " Given z = 6 + 0 i, then root z = root 6"
633+
634+ | squareRoot expected |
635+ squareRoot := (PMComplex real: 6 imaginary: 0 ) sqrt.
636+
637+ expected := PMComplex real: (6 sqrt) imaginary: 0 .
638+ self assert: squareRoot equals: expected
639+ ]
640+
641+ { #category : #tests }
642+ PMComplexTest >> testSquareRootOfZeroIsZero [
643+ " comment stating purpose of instance-side method"
644+ " scope: class-variables & instance-variables"
645+
646+ | squareRoot expected |
647+ squareRoot := (0 + 0 i) sqrt .
648+
649+ expected := PMComplex zero.
650+ self assert: squareRoot equals: expected.
651+ ]
652+
629653{ #category : #tests }
630654PMComplexTest >> testSquared [
631655 " self run: #testSquared"
You can’t perform that action at this time.
0 commit comments