Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Factor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ _is_legal(a::Fac) = xor(isdefined(a, :fac), isdefined(a, :arr))

_is_dic(a::Fac) = _is_legal(a) && isdefined(a, :fac)

function Base.:(==)(F1::Fac{T1}, F2::Fac{T2}) where {T1 <: RingElement, T2 <: RingElement}
error("Equality testing of factorizations is not supported");
end

@doc raw"""
unit(a::Fac{T}) -> T

Expand Down
9 changes: 9 additions & 0 deletions test/Factor-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,12 @@ end
@test string(f) == "x * (x + y) * (x*y)" ||
string(f) == "x * (x*y) * (x + y)"
end

@testset "Fac.equality" begin
# 2025-10-20 equality test on factorizations always gives error (even if the args are ===)
f = Fac(-1, Dict{Int, Int}(2 => 3, 3 => 1))
ff = Fac(-1, [2 => 3, 3 => 1])

@test_throws ErrorException f == f
@test_throws ErrorException (f == ff)
end