Skip to content

Commit

Permalink
refactor: we can use Polynomial's = message to reduce number of asser…
Browse files Browse the repository at this point in the history
…tions.
  • Loading branch information
hemalvarambhia committed Dec 27, 2023
1 parent 7e46a25 commit 4b0e6ce
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Math-Tests-Polynomials/PMPolynomialTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ PMPolynomialTest >> testIsZero [

{ #category : #'testing - addition' }
PMPolynomialTest >> testPolynomialAddition [
| polynomial |
polynomial := (PMPolynomial coefficients: #(2 -3 1))
+ (PMPolynomial coefficients: #(-3 7 2 1)).
self assert: (polynomial at: 0) equals: -1.
self assert: (polynomial at: 1) equals: 4.
self assert: (polynomial at: 2) equals: 3.
self assert: (polynomial at: 3) equals: 1.

| polynomial expected |
polynomial := (PMPolynomial coefficients: #( 2 -3 1 ))
+ (PMPolynomial coefficients: #( -3 7 2 1 )).
expected := PMPolynomial coefficients: #( -1 4 3 1 ).
self assert: polynomial equals: expected.
self assert: (polynomial at: 4) equals: 0
]

Expand Down

0 comments on commit 4b0e6ce

Please sign in to comment.