Skip to content

Commit

Permalink
Test hash consing for Sym with metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenszhu committed Nov 5, 2024
1 parent d36198f commit cf937b0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/hash_consing.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using SymbolicUtils, Test

struct Ctx1 end
struct Ctx2 end

@testset "Sym" begin
x1 = only(@syms x)
x2 = only(@syms x)
Expand All @@ -14,4 +17,10 @@ using SymbolicUtils, Test
@test x1 !== x5
@test x3 !== x5
@test x5 === x6

xm1 = setmetadata(x1, Ctx1, "meta_1")
xm2 = setmetadata(x1, Ctx1, "meta_1")
@test xm1 === xm2
xm3 = setmetadata(x1, Ctx2, "meta_2")
@test xm1 !== xm3
end

0 comments on commit cf937b0

Please sign in to comment.