Skip to content

Commit 1597a00

Browse files
Refactor complex number tests: Categorised the test and added other interesting test cases (#253)
* Clarified the category and the name of the message, that it computes the argument of a pure imaginary number. * Added a missing test for positive real numbers. * Clarified the test name. * Added a missing test that feels interesting. * Clarified the name of the message and made it more consistent. * Added a missing test that checks the argument of a complex number with a real and imaginary part. * Simplified the complex number for which the argument is computed.
1 parent 3cf9948 commit 1597a00

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,13 @@ PMComplexTest >> testArcTanDenominator [
162162
self assert: (c2 arcTan: c1 * c1) equals: Float pi
163163
]
164164

165-
{ #category : #tests }
166-
PMComplexTest >> testArg [
165+
{ #category : #'testing - polar coordinates' }
166+
PMComplexTest >> testArgumentOfAComplexNumber [
167+
self assert: (1 + 1 i) arg equals: Float pi / 4
168+
]
169+
170+
{ #category : #'testing - polar coordinates' }
171+
PMComplexTest >> testArgumentOfAPositivePureImaginaryNumber [
167172
"self run: #testArg"
168173

169174
"self debug: #testArg"
@@ -173,6 +178,16 @@ PMComplexTest >> testArg [
173178
self assert: c arg equals: Float pi / 2
174179
]
175180

181+
{ #category : #'testing - polar coordinates' }
182+
PMComplexTest >> testArgumentOfAPositiveRealNumber [
183+
self assert: (5 + 0 i) arg equals: 0.
184+
]
185+
186+
{ #category : #'testing - polar coordinates' }
187+
PMComplexTest >> testArgumentOfPureNegativeImaginaryNumber [
188+
self assert: -1 i arg equals: (Float pi / 2) negated
189+
]
190+
176191
{ #category : #'testing - bugs' }
177192
PMComplexTest >> testBug1 [
178193
self assert: (0.5 * (2 + 0 i) ln) exp equals: (0.5 * 2 ln) exp

0 commit comments

Comments
 (0)