From 75c2fd8e752870b0f4db625fc22a36e9cf13801e Mon Sep 17 00:00:00 2001 From: hemalvarambhia Date: Wed, 27 Dec 2023 19:38:38 +0000 Subject: [PATCH] refactor: Extract Variable so we can show the operation being tested clearly. --- src/Math-Tests-Polynomials/PMPolynomialTest.class.st | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Math-Tests-Polynomials/PMPolynomialTest.class.st b/src/Math-Tests-Polynomials/PMPolynomialTest.class.st index fea49c4d..7000186c 100644 --- a/src/Math-Tests-Polynomials/PMPolynomialTest.class.st +++ b/src/Math-Tests-Polynomials/PMPolynomialTest.class.st @@ -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 @@ -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