Skip to content

Commit e84a4bf

Browse files
test: test caching of hash2
1 parent f02d929 commit e84a4bf

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/hash_consing.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,13 @@ end
137137
@test x1 !== x2
138138
SymbolicUtils.ENABLE_HASHCONSING[] = true
139139
end
140+
141+
@testset "`hash2` is cached" begin
142+
@syms a b f(..)
143+
for ex in [a + b, a * b, f(a)]
144+
h = SymbolicUtils.hash2(ex)
145+
@test h == ex.hash2[]
146+
ex2 = setmetadata(ex, Int, 3)
147+
@test ex2.hash2[] != h
148+
end
149+
end

0 commit comments

Comments
 (0)