Skip to content

Commit

Permalink
More test coverage for coeff
Browse files Browse the repository at this point in the history
`coeff` works with symbolic and non-integral powers.
However, this case is not covered in unit tests.

Add tests to preserve this functionality into the future.
  • Loading branch information
NAThompson committed May 7, 2024
1 parent b8f7cf6 commit 5b397b5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/coeff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import Symbolics: coeff
@test isequal(coeff(2a, x), 0)
@test isequal(coeff(a*x, x), a)
@test isequal(coeff(2x*a, x), 2a)
# Symbolic powers:
@test isequal(coeff(a*x^b, x^b), a)
@test isequal(coeff(a*x^(b+1), x^(b+1)), a)
# Irrational powers:
@test isequal(coeff(a*x^sqrt(2), x^sqrt(2)), a)

@test isequal(coeff(a + x, x), 1)
@test isequal(coeff(2(a + x), x), 2)
Expand Down

0 comments on commit 5b397b5

Please sign in to comment.