Skip to content

Commit 3f3d013

Browse files
committed
Add test for hash2 for equivalent numbers
1 parent e5fb7ce commit 3f3d013

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/hash_consing.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using SymbolicUtils, Test
2-
using SymbolicUtils: Term, Add, Mul, Div, Pow
2+
using SymbolicUtils: Term, Add, Mul, Div, Pow, hash2
33

44
struct Ctx1 end
55
struct Ctx2 end
@@ -99,3 +99,10 @@ end
9999
pm1 = setmetadata(p1,Ctx1, "meta_1")
100100
@test pm1 !== p1
101101
end
102+
103+
@testset "Equivalent numbers" begin
104+
f = 0.5
105+
r = 1 // 2
106+
@test hash(f) == hash(r)
107+
@test hash2(f) != hash2(r)
108+
end

0 commit comments

Comments
 (0)