Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

These tests should be in AbstractPPL (if they aren't already) #737

Open
penelopeysm opened this issue Dec 5, 2024 · 1 comment
Open
Labels

Comments

@penelopeysm
Copy link
Member

# Test Base functions:
# string, Symbol, ==, hash, in, keys, haskey, isempty, push!!, empty!!,
# getindex, setindex!, getproperty, setproperty!
csym = gensym()
vn1 = @varname x[1][2]
@test string(vn1) == "x[1][2]"
@test Symbol(vn1) == Symbol("x[1][2]")
vn2 = @varname x[1][2]
@test vn2 == vn1
@test hash(vn2) == hash(vn1)
@test inspace(vn1, (:x,))
# Tests for `inspace`
space = (:x, :y, @varname(z[1]), @varname(M[1:10, :]))
@test inspace(@varname(x), space)
@test inspace(@varname(y), space)
@test inspace(@varname(x[1]), space)
@test inspace(@varname(z[1][1]), space)
@test inspace(@varname(z[1][:]), space)
@test inspace(@varname(z[1][2:3:10]), space)
@test inspace(@varname(M[[2, 3], 1]), space)
@test_throws ErrorException inspace(@varname(M[:, 1:4]), space)
@test inspace(@varname(M[1, [2, 4, 6]]), space)
@test !inspace(@varname(z[2]), space)
@test !inspace(@varname(z), space)

penelopeysm added a commit to TuringLang/AbstractPPL.jl that referenced this issue Dec 5, 2024
penelopeysm added a commit to TuringLang/AbstractPPL.jl that referenced this issue Dec 5, 2024
* Add varname tests from DPPL

cf. TuringLang/DynamicPPL.jl#737

* Format

* Format readme
@penelopeysm
Copy link
Member Author

penelopeysm commented Dec 7, 2024

I added them to AbstractPPL TuringLang/AbstractPPL.jl#111, so what remains is to remove them from here.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant