Skip to content

Commit

Permalink
refactor: extracted temp, renamed a temp to tell a better story.
Browse files Browse the repository at this point in the history
  • Loading branch information
hemalvarambhia committed Dec 27, 2023
1 parent 31baea4 commit c76f8f9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Math-Tests-Polynomials/PMPolynomialTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@ PMPolynomialTest >> testPolynomialAdditionIsCommutative [
PMPolynomialTest >> testPolynomialDerivative [
"Code example 2.3"

| polynomial expectedDerivative |
polynomial := (PMPolynomial coefficients: #( -3 7 2 1 )) derivative.
| p derivative expectedDerivative |
p := PMPolynomial coefficients: #( -3 7 2 1 ).

derivative := p derivative.

expectedDerivative := PMPolynomial coefficients: #( 7 4 3 ).
self assert: polynomial equals: expectedDerivative.
self assert: (polynomial at: 3) equals: 0.
self assert: (polynomial at: 4) equals: 0
self assert: derivative equals: expectedDerivative.
self assert: (derivative at: 3) equals: 0.
self assert: (derivative at: 4) equals: 0
]

{ #category : #'testing - division' }
Expand Down

0 comments on commit c76f8f9

Please sign in to comment.