Skip to content

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

@penelopeysm

Description

@penelopeysm

# 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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions