-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #658 from JuliaSymbolics/hash-consing
Implement hash consing for `Sym`
- Loading branch information
Showing
6 changed files
with
123 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using SymbolicUtils, Test | ||
|
||
struct Ctx1 end | ||
struct Ctx2 end | ||
|
||
@testset "Sym" begin | ||
x1 = only(@syms x) | ||
x2 = only(@syms x) | ||
@test x1 === x2 | ||
x3 = only(@syms x::Float64) | ||
@test x1 !== x3 | ||
x4 = only(@syms x::Float64) | ||
@test x1 !== x4 | ||
@test x3 === x4 | ||
x5 = only(@syms x::Int) | ||
x6 = only(@syms x::Int) | ||
@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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters