Skip to content

Commit 3ce4b29

Browse files
Added additional characterisation tests.
1 parent a69b655 commit 3ce4b29

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff 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 }
630654
PMComplexTest >> testSquared [
631655
"self run: #testSquared"

0 commit comments

Comments
 (0)