@@ -10,7 +10,7 @@ PMComplexTest >> testAPureImaginaryNumberIsNotEqualToZero [
1010 self deny: 0 equals: 1 i.
1111]
1212
13- { #category : #tests }
13+ { #category : #' testing - arithmetic ' }
1414PMComplexTest >> testAbs [
1515 " self run: #testAbs"
1616
@@ -21,7 +21,7 @@ PMComplexTest >> testAbs [
2121 self assert: c abs equals: 72 sqrt
2222]
2323
24- { #category : #tests }
24+ { #category : #' testing - arithmetic ' }
2525PMComplexTest >> testAbsSecure [
2626 " self run: #testAbsSecure"
2727
@@ -63,7 +63,7 @@ PMComplexTest >> testAddingTwoComplexNumbers [
6363 self assert: c equals: 0 + 2 i
6464]
6565
66- { #category : #tests }
66+ { #category : #' testing - mathematical functions ' }
6767PMComplexTest >> testArCosh [
6868 | c |
6969 c := (2.5 + 0 i).
@@ -77,7 +77,7 @@ PMComplexTest >> testArCosh [
7777 self deny: c arCosh real negative]]
7878]
7979
80- { #category : #tests }
80+ { #category : #' testing - mathematical functions ' }
8181PMComplexTest >> testArSinh [
8282 | c |
8383 c := (2.5 + 0 i).
@@ -90,7 +90,7 @@ PMComplexTest >> testArSinh [
9090 self assert: (c arSinh sinh imaginary closeTo: c imaginary)]]
9191]
9292
93- { #category : #tests }
93+ { #category : #' testing - mathematical functions ' }
9494PMComplexTest >> testArTanh [
9595 | c |
9696 c := (0.5 + 0 i).
@@ -103,7 +103,7 @@ PMComplexTest >> testArTanh [
103103 self assert: (c arTanh tanh imaginary closeTo: c imaginary)]]
104104]
105105
106- { #category : #tests }
106+ { #category : #' testing - mathematical functions ' }
107107PMComplexTest >> testArcCos [
108108 | c |
109109 c := (0.5 + 0 i).
@@ -116,7 +116,7 @@ PMComplexTest >> testArcCos [
116116 self assert: (c arcCos cos imaginary closeTo: c imaginary)]]
117117]
118118
119- { #category : #tests }
119+ { #category : #' testing - mathematical functions ' }
120120PMComplexTest >> testArcCosPlusArcSin [
121121 | c |
122122 #(-0.5 -2 -3 0 0.5 2 3) do: [:real |
@@ -126,7 +126,7 @@ PMComplexTest >> testArcCosPlusArcSin [
126126 self assert: ((c arcCos + c arcSin) imaginary closeTo: 0.0 )]]
127127]
128128
129- { #category : #tests }
129+ { #category : #' testing - mathematical functions ' }
130130PMComplexTest >> testArcSin [
131131 | c |
132132 c := (0.5 + 0 i).
@@ -139,7 +139,7 @@ PMComplexTest >> testArcSin [
139139 self assert: (c arcSin sin imaginary closeTo: c imaginary)]]
140140]
141141
142- { #category : #tests }
142+ { #category : #' testing - mathematical functions ' }
143143PMComplexTest >> testArcTan [
144144 | c |
145145 c := (0.5 + 0 i).
@@ -152,7 +152,7 @@ PMComplexTest >> testArcTan [
152152 self assert: (c arcTan tan imaginary closeTo: c imaginary)]]
153153]
154154
155- { #category : #tests }
155+ { #category : #' testing - mathematical functions ' }
156156PMComplexTest >> testArcTanDenominator [
157157 | c1 c2 |
158158 c1 := 1 i.
@@ -226,27 +226,6 @@ PMComplexTest >> testCloseToWithPrecision [
226226 self assert: 2.001 + 3. 001i closeTo: 2 + 3i precision: 0.01 .
227227]
228228
229- { #category : #tests }
230- PMComplexTest >> testComplexAsComplex [
231- | ineg |
232- ineg := - 1 i.
233- self assert: ineg asComplex == ineg.
234- ]
235-
236- { #category : #tests }
237- PMComplexTest >> testComplexCollection [
238- " self run: #testComplexCollection"
239-
240- " self debug: #testComplexCollection"
241-
242- | array array2 |
243- array := Array with: 1 + 2 i with: 3 + 4 i with: 5 + 6 i.
244- array2 := 2 * array.
245- array
246- with: array2
247- do: [ :one :two | self assert: 2 * one equals: two ]
248- ]
249-
250229{ #category : #' testing - arithmetic' }
251230PMComplexTest >> testComplexConjugate [
252231
@@ -272,7 +251,7 @@ PMComplexTest >> testConversion [
272251 self assert: 2 / 3 + (1 + 2 i) equals: 5 / 3 + 2 i
273252]
274253
275- { #category : #tests }
254+ { #category : #' testing - mathematical functions ' }
276255PMComplexTest >> testCos [
277256 | c c2 |
278257 c := (2 + 0 i).
@@ -284,7 +263,7 @@ PMComplexTest >> testCos [
284263 self assert: (c cos imaginary closeTo: c2 imaginary).
285264]
286265
287- { #category : #tests }
266+ { #category : #' testing - mathematical functions ' }
288267PMComplexTest >> testCos2PlusSin2 [
289268 | c |
290269 #(-0.5 -2 -3 0 0.5 2 3) do: [:real |
@@ -294,7 +273,7 @@ PMComplexTest >> testCos2PlusSin2 [
294273 self assert: ((c cos squared + c sin squared) imaginary closeTo: 0.0 )]]
295274]
296275
297- { #category : #tests }
276+ { #category : #' testing - mathematical functions ' }
298277PMComplexTest >> testCosh [
299278 | c c2 |
300279 c := (2 + 0 i).
@@ -309,7 +288,7 @@ PMComplexTest >> testCosh [
309288 self assert: (c cosh imaginary closeTo: c2 imaginary).
310289]
311290
312- { #category : #tests }
291+ { #category : #' testing - mathematical functions ' }
313292PMComplexTest >> testCosh2MinusSinh2 [
314293 | c |
315294 #(-0.5 -2 -3 0 0.5 2 3) do: [:real |
@@ -468,12 +447,12 @@ PMComplexTest >> testIsRealNumberOnReal [
468447 self assert: 0.5 isRealNumber
469448]
470449
471- { #category : #tests }
450+ { #category : #' testing - mathematical functions ' }
472451PMComplexTest >> testLn [
473452 self assert: (Float e + 0 i) ln equals: Float e ln " See Bug 1815 on Mantis"
474453]
475454
476- { #category : #tests }
455+ { #category : #' testing - mathematical functions ' }
477456PMComplexTest >> testLog [
478457 self assert: (Float e + 0 i log: Float e) equals: Float e ln. " See Bug 1815 on Mantis"
479458 self assert: (2 + 0 i log: 2 ) equals: 1
@@ -486,6 +465,19 @@ PMComplexTest >> testMultiplyByI [
486465 self assert: c * 1 i equals: c i
487466]
488467
468+ { #category : #' testing - arithmetic' }
469+ PMComplexTest >> testMultiplyingArraysOfComplexNumbers [
470+ | complexNumbersMultiplied complexNumbers expected |
471+ complexNumbers := Array with: 1 + 2 i with: 3 + 4 i with: 5 + 6 i.
472+
473+ complexNumbersMultiplied := 2 * complexNumbers .
474+
475+ expected := Array with: 2 + 4 i with: 6 + 8 i with: 10 + 12 i.
476+ complexNumbersMultiplied
477+ with: expected
478+ do: [ :actual :expectedComplexNumber | self assert: actual equals: expectedComplexNumber ]
479+ ]
480+
489481{ #category : #' testing - arithmetic' }
490482PMComplexTest >> testMultiplyingByPolynomials [
491483 | c poly |
@@ -548,7 +540,7 @@ PMComplexTest >> testOne [
548540 self assert: one imaginary equals: 0
549541]
550542
551- { #category : #tests }
543+ { #category : #' testing - arithmetic ' }
552544PMComplexTest >> testProductWithVector [
553545 | v c |
554546 c := 1 + 1 i.
@@ -566,7 +558,7 @@ PMComplexTest >> testPureImaginaryNumbersAreNotEqualToObjectsOfADifferentType [
566558 self deny: #(1 2 3) = 1 i.
567559]
568560
569- { #category : #tests }
561+ { #category : #' testing - mathematical functions ' }
570562PMComplexTest >> testRaisedTo [
571563
572564 | c c3 |
@@ -576,7 +568,7 @@ PMComplexTest >> testRaisedTo [
576568 self assert: (c3 imaginary closeTo: c imaginary).
577569]
578570
579- { #category : #tests }
571+ { #category : #' testing - mathematical functions ' }
580572PMComplexTest >> testRaisedToInteger [
581573 | c c3 |
582574 c := 5 - 6 i.
@@ -605,17 +597,6 @@ PMComplexTest >> testReciprocal [
605597 self assert: c reciprocal equals: 2 / 29 - (5 / 29 ) i
606598]
607599
608- { #category : #tests }
609- PMComplexTest >> testReciprocalError [
610- " self run: #testReciprocalError"
611- " self debug: #testReciprocalError"
612-
613- | c |
614- c := (0 i).
615- self should: [c reciprocal] raise: ZeroDivide
616-
617- ]
618-
619600{ #category : #' testing - arithmetic' }
620601PMComplexTest >> testSecureDivision1 [
621602 " self run: #testSecureDivision1"
@@ -642,7 +623,7 @@ PMComplexTest >> testSecureDivision2 [
642623
643624]
644625
645- { #category : #tests }
626+ { #category : #' testing - mathematical functions ' }
646627PMComplexTest >> testSin [
647628 | c c2 |
648629 c := (2 + 0 i).
@@ -654,7 +635,7 @@ PMComplexTest >> testSin [
654635 self assert: (c sin imaginary closeTo: c2 imaginary).
655636]
656637
657- { #category : #tests }
638+ { #category : #' testing - mathematical functions ' }
658639PMComplexTest >> testSinh [
659640 | c c2 |
660641 c := (2 + 0 i).
@@ -672,7 +653,7 @@ PMComplexTest >> testSinh [
672653 self assert: (c sinh imaginary closeTo: c2 imaginary).
673654]
674655
675- { #category : #tests }
656+ { #category : #' testing - mathematical functions ' }
676657PMComplexTest >> testSquareRootOfANegativeRealNumberIsPureImaginary [
677658
678659 " Given z = -4 + 0 i, the square root is 2 i"
@@ -685,7 +666,7 @@ PMComplexTest >> testSquareRootOfANegativeRealNumberIsPureImaginary [
685666 self assert: squareRoot equals: 2 i
686667]
687668
688- { #category : #tests }
669+ { #category : #' testing - mathematical functions ' }
689670PMComplexTest >> testSquareRootOfComplexNumberIsAComplexNumber [
690671 | squareRoot z |
691672 z := PMComplex real: 2 imaginary: 2 .
@@ -696,7 +677,7 @@ PMComplexTest >> testSquareRootOfComplexNumberIsAComplexNumber [
696677 self assert: squareRoot imaginary closeTo: 0.643594253
697678]
698679
699- { #category : #tests }
680+ { #category : #' testing - mathematical functions ' }
700681PMComplexTest >> testSquareRootOfNegativePureImaginaryNumberIsAComplexNumberWithRealAndImaginaryParts [
701682 | squareRoot expected pureImaginaryNumber |
702683 pureImaginaryNumber := PMComplex real: 0 imaginary: - 4 .
@@ -709,7 +690,7 @@ PMComplexTest >> testSquareRootOfNegativePureImaginaryNumberIsAComplexNumberWith
709690
710691]
711692
712- { #category : #tests }
693+ { #category : #' testing - mathematical functions ' }
713694PMComplexTest >> testSquareRootOfPositivePureImaginaryNumberIsAComplexNumberWithRealAndImaginaryParts [
714695
715696 " e.g. square root of 4 i = root(2) + i root(2)"
@@ -724,7 +705,7 @@ PMComplexTest >> testSquareRootOfPositivePureImaginaryNumberIsAComplexNumberWith
724705 self assert: squareRoot imaginary closeTo: expected imaginary
725706]
726707
727- { #category : #tests }
708+ { #category : #' testing - mathematical functions ' }
728709PMComplexTest >> testSquareRootOfPositiveRealNumberIsAComplexNumberWithOnlyARealPart [
729710
730711 " Given z = 6 + 0 i, then root z = root 6"
@@ -738,7 +719,7 @@ PMComplexTest >> testSquareRootOfPositiveRealNumberIsAComplexNumberWithOnlyAReal
738719 self assert: squareRoot equals: expected
739720]
740721
741- { #category : #tests }
722+ { #category : #' testing - mathematical functions ' }
742723PMComplexTest >> testSquareRootOfVeryLargeRealAndVerySmallImaginary [
743724 " This may cause problems because of the loss of precision.
744725 Very large and very small floating point numbers have different units of least precision.
@@ -757,7 +738,7 @@ PMComplexTest >> testSquareRootOfVeryLargeRealAndVerySmallImaginary [
757738 self assert: complexNumber sqrt closeTo: expected
758739]
759740
760- { #category : #tests }
741+ { #category : #' testing - mathematical functions ' }
761742PMComplexTest >> testSquareRootOfVerySmallRealAndVeryLargeImaginary [
762743 " This may cause problems because of the loss of precision.
763744 Very large and very small floating point numbers have different units of least precision.
@@ -776,7 +757,7 @@ PMComplexTest >> testSquareRootOfVerySmallRealAndVeryLargeImaginary [
776757 self assert: complexNumber sqrt closeTo: expected
777758]
778759
779- { #category : #tests }
760+ { #category : #' testing - mathematical functions ' }
780761PMComplexTest >> testSquareRootOfZeroIsZero [
781762 " comment stating purpose of instance-side method"
782763 " scope: class-variables & instance-variables"
@@ -788,7 +769,7 @@ PMComplexTest >> testSquareRootOfZeroIsZero [
788769 self assert: squareRoot equals: expected.
789770]
790771
791- { #category : #tests }
772+ { #category : #' testing - mathematical functions ' }
792773PMComplexTest >> testSquared [
793774 " self run: #testSquared"
794775
@@ -810,7 +791,7 @@ PMComplexTest >> testSubtractingPolynomials [
810791 self assert: (poly - c at: 0 ) equals: - 3 i
811792]
812793
813- { #category : #tests }
794+ { #category : #' testing - mathematical functions ' }
814795PMComplexTest >> testTan [
815796 | c c2 |
816797 c := (2 + 0 i).
@@ -822,7 +803,7 @@ PMComplexTest >> testTan [
822803 self assert: (c2 imaginary closeTo: c tan imaginary).
823804]
824805
825- { #category : #tests }
806+ { #category : #' testing - mathematical functions ' }
826807PMComplexTest >> testTanh [
827808 | c c2 |
828809 c := (2 + 0 i).
@@ -862,7 +843,7 @@ PMComplexTest >> testWeCanWriteComplexNumbersWhoseRealAndImaginaryPartsAreFracti
862843]
863844
864845{ #category : #' testing - arithmetic' }
865- PMComplexTest >> testWeCannotTakeReciprocalOfZeroComplexNumbers [
846+ PMComplexTest >> testWeCannotTheTakeReciprocalOfZeroComplexNumbers [
866847 self should: [ PMComplex zero reciprocal ] raise: ZeroDivide .
867848]
868849
0 commit comments