Skip to content

Commit ecb00fc

Browse files
refactor: reduce the number of assertions by equating polynomials rather than coefficients.
1 parent a3e7f96 commit ecb00fc

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/Math-Tests-Polynomials/PMPolynomialTest.class.st

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,18 @@ PMPolynomialTest >> testPolynomialIntegral [
143143
PMPolynomialTest >> testPolynomialIntegralWithConstant [
144144
"Code example 2.3"
145145

146-
| polynomial arbitraryConstant integrand |
146+
| polynomial arbitraryConstant integrand expectedCoefficients expected |
147147
arbitraryConstant := 5.
148148
integrand := PMPolynomial coefficients: #( -3 7 2 1 ).
149149
polynomial := integrand integral: arbitraryConstant.
150-
self assert: (polynomial at: 0) equals: 5.
151-
self assert: (polynomial at: 1) equals: -3.
152-
self assert: (polynomial at: 2) equals: 7 / 2.
153-
self assert: (polynomial at: 3) equals: 2 / 3.
154-
self assert: (polynomial at: 4) equals: 1 / 4.
150+
expectedCoefficients := Array
151+
with: 5
152+
with: -3
153+
with: 7 / 2
154+
with: 2 / 3
155+
with: 1 / 4.
156+
expected := PMPolynomial coefficients: expectedCoefficients.
157+
self assert: polynomial equals: expected.
155158
self assert: (polynomial at: 5) equals: 0
156159
]
157160

0 commit comments

Comments
 (0)