Skip to content
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
test equality of function terms
  • Loading branch information
kleinschmidt committed Sep 21, 2021
commit 68b240aa1031c6a2425d90b749a453a165d52c2f
23 changes: 22 additions & 1 deletion test/terms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,26 @@ StatsModels.apply_schema(mt::MultiTerm, sch::StatsModels.Schema, Mod::Type) =
end

end


@testset "equality of function terms" begin
# for now, we use `@formula` to construct the function terms
f1 = @formula(0 ~ (1 | x)).rhs
f2 = @formula(0 ~ (1 | x)).rhs
@test f1 !== f2
@test f1 == f2
@test hash(f1) == hash(f2)

f3 = @formula(0 ~ (1 % x)).rhs
@test f1 != f3
@test hash(f1) != hash(f3)

f4 = @formula(0 ~ (x | 1)).rhs
@test f1 != f4
@test hash(f1) != hash(f4)

f5 = @formula(0 ~ (1 & y | x)).rhs
@test f1 != f5
@test hash(f1) != hash(f5)
end

end