Skip to content

Commit

Permalink
refactor: Extract Variable so we can show the operation being tested …
Browse files Browse the repository at this point in the history
…clearly.
  • Loading branch information
hemalvarambhia committed Dec 27, 2023
1 parent 4ddc12b commit 75c2fd8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Math-Tests-Polynomials/PMPolynomialTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@ PMPolynomialTest >> testPolynomialMultiplicationIsCommutative [
{ #category : #'testing - addition' }
PMPolynomialTest >> testPolynomialNumberAddition [

| polynomial expected |
polynomial := 2 + (PMPolynomial coefficients: #( 2 -3 1 )).
| polynomial expected p |
p := PMPolynomial coefficients: #( 2 -3 1 ).
polynomial := 2 + p.
expected := PMPolynomial coefficients: #( 4 -3 1 ).
self assert: polynomial equals: expected.
self assert: (polynomial at: 3) equals: 0
Expand All @@ -191,8 +192,9 @@ PMPolynomialTest >> testPolynomialNumberAddition [
{ #category : #'testing - addition' }
PMPolynomialTest >> testPolynomialNumberAdditionInverse [

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

0 comments on commit 75c2fd8

Please sign in to comment.