Skip to content

Commit

Permalink
refactor: Rename Variable where we make the roles of the objects clea…
Browse files Browse the repository at this point in the history
…rer in the tests.
  • Loading branch information
hemalvarambhia committed Dec 24, 2023
1 parent 2fc4e5d commit 6de9e74
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Math-Tests-Polynomials/PMPolynomialTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -245,22 +245,22 @@ PMPolynomialTest >> testPolynomialRoots [
{ #category : #'iterative algorithms' }
PMPolynomialTest >> testPolynomialRootsConstantsHaveNoRoots [

| polynomial |
| constant |
"Here, compute the roots of the constant C = 1"
polynomial := PMPolynomial coefficients: #( 1 ).
constant := PMPolynomial coefficients: #( 1 ).
self
should: [ polynomial roots ]
should: [ constant roots ]
raise: Error
description: 'Function''s derivative seems to be zero everywhere'
]

{ #category : #'iterative algorithms' }
PMPolynomialTest >> testPolynomialRootsForLinear [

| polynomial roots |
| linearPolynomial roots |
"Here, compute the roots of the linear (2x + 1)"
polynomial := PMPolynomial coefficients: #( 1 2 ).
roots := polynomial roots.
linearPolynomial := PMPolynomial coefficients: #( 1 2 ).
roots := linearPolynomial roots.
self assert: roots size equals: 1.
self assert: (roots at: 1) closeTo: -0.5
]
Expand All @@ -279,10 +279,10 @@ PMPolynomialTest >> testPolynomialSubtraction [

{ #category : #'iterative algorithms' }
PMPolynomialTest >> testPolynomialWithRepeatedRoots [
| polynomial roots |
| polynomialWithRepeatedRoots roots |
"Here, compute the roots of the quadratic (2x + 1)^2 = 4 x^2 + 4 x + 1"
polynomial := PMPolynomial coefficients: #(1 4 4).
roots := polynomial roots .
polynomialWithRepeatedRoots := PMPolynomial coefficients: #(1 4 4).
roots := polynomialWithRepeatedRoots roots .
self assert: roots size equals: 2.
self assert: (roots at: 1) closeTo: -0.5 .
self assert: (roots at: 2) closeTo: -0.5 .
Expand Down

0 comments on commit 6de9e74

Please sign in to comment.