Skip to content

Commit cf937b0

Browse files
committed
Test hash consing for Sym with metadata
1 parent d36198f commit cf937b0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/hash_consing.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
using SymbolicUtils, Test
22

3+
struct Ctx1 end
4+
struct Ctx2 end
5+
36
@testset "Sym" begin
47
x1 = only(@syms x)
58
x2 = only(@syms x)
@@ -14,4 +17,10 @@ using SymbolicUtils, Test
1417
@test x1 !== x5
1518
@test x3 !== x5
1619
@test x5 === x6
20+
21+
xm1 = setmetadata(x1, Ctx1, "meta_1")
22+
xm2 = setmetadata(x1, Ctx1, "meta_1")
23+
@test xm1 === xm2
24+
xm3 = setmetadata(x1, Ctx2, "meta_2")
25+
@test xm1 !== xm3
1726
end

0 commit comments

Comments
 (0)