Skip to content

Commit 4b89858

Browse files
refactor: extracted the expected coefficients to a local variable to make equating Polynomials simpler.
1 parent 8320ec0 commit 4b89858

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,15 @@ PMPolynomialTest >> testPolynomialHash [
127127
PMPolynomialTest >> testPolynomialIntegral [
128128
"Code example 2.3"
129129

130-
| polynomial |
131-
polynomial := (PMPolynomial coefficients: #(-3 7 2 1)) integral.
132-
self assert: (polynomial at: 0) equals: 0.
133-
self assert: (polynomial at: 1) equals: -3.
134-
self assert: (polynomial at: 2) equals: 7 / 2.
135-
self assert: (polynomial at: 3) equals: 2 / 3.
136-
self assert: (polynomial at: 4) equals: 1 / 4.
130+
| polynomial expectedCoefficients expected |
131+
polynomial := (PMPolynomial coefficients: #( -3 7 2 1 )) integral.
132+
expectedCoefficients := Array
133+
with: 0
134+
with: -3
135+
with: 7 / 2
136+
with: 2 / 3
137+
with: 1 / 4.
138+
expected := PMPolynomial coefficients: expectedCoefficients.
137139
self assert: (polynomial at: 5) equals: 0
138140
]
139141

0 commit comments

Comments
 (0)