Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
projekter committed Dec 16, 2023
1 parent 3d91792 commit 10df61e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@
ordinary_variable(real(x)) ==
ordinary_variable(imag(x)) ==
ordinary_variable(x)
@testset "show" begin
struct SymbolVar <: MP.AbstractVariable end
struct SymbolConjVar <: MP.AbstractVariable end
Base.isreal(::Union{SymbolVar,SymbolConjVar}) = false
MP.name_base_indices(::Union{SymbolVar,SymbolConjVar}) = (:xy, (1, 2))
MP.isconj(::SymbolConjVar) = true
@test sprint(show, SymbolVar()) == "xy₁₋₂"
@test sprint(show, SymbolConjVar()) == "x̅y̅₁₋₂"
end
@test conj(x) != x && conj(conj(x)) == x
@test real(x) == real(conj(x))
@test imag(conj(x)) == -imag(x)
Expand Down

0 comments on commit 10df61e

Please sign in to comment.