|
1 | 1 | using .Turing, Random, MacroTools, Distributions, Test
|
2 |
| -using DynamicPPL: DynamicPPL, @vsym, @vinds, @varname, VarInfo, VarName |
| 2 | +using DynamicPPL: DynamicPPL, vsym, vinds, @varname, VarInfo, VarName |
3 | 3 |
|
4 | 4 | dir = splitdir(splitdir(pathof(DynamicPPL))[1])[1]
|
5 | 5 | include(dir*"/test/test_utils/AllUtils.jl")
|
@@ -498,33 +498,29 @@ priors = 0 # See "new grammar" test.
|
498 | 498 | end
|
499 | 499 | @testset "var name splitting" begin
|
500 | 500 | var_expr = :(x)
|
501 |
| - sym, inds = @eval @vsym($var_expr), @vinds($var_expr) |
502 |
| - @test sym == :x |
503 |
| - @test inds == () |
| 501 | + sym, inds = vsym(var_expr), vinds(var_expr) |
| 502 | + @test sym == :(:x) |
| 503 | + @test inds == :(()) |
504 | 504 |
|
505 | 505 | var_expr = :(x[1,1][2,3])
|
506 |
| - sym, inds = @eval @vsym($var_expr), @vinds($var_expr) |
507 |
| - @test sym == :x |
508 |
| - @test inds[1] == (1, 1) |
509 |
| - @test inds[2] == (2, 3) |
| 506 | + sym, inds = vsym(var_expr), vinds(var_expr) |
| 507 | + @test sym == :(:x) |
| 508 | + @test inds == :(((1, 1), (2, 3))) |
510 | 509 |
|
511 |
| - var_expr = :(x[Colon(),1][2,Colon()]) |
512 |
| - sym, inds = @eval @vsym($var_expr), @vinds($var_expr) |
513 |
| - @test sym == :x |
514 |
| - @test inds[1] == (Colon(), 1) |
515 |
| - @test inds[2] == (2, Colon()) |
| 510 | + var_expr = :(x[:,1][2,:]) |
| 511 | + sym, inds = vsym(var_expr), vinds(var_expr) |
| 512 | + @test sym == :(:x) |
| 513 | + @test inds == :(((:, 1), (2, :))) |
516 | 514 |
|
517 | 515 | var_expr = :(x[2:3,1][2,1:2])
|
518 |
| - sym, inds = @eval @vsym($var_expr), @vinds($var_expr) |
519 |
| - @test sym == :x |
520 |
| - @test inds[1] == (2:3, 1) |
521 |
| - @test inds[2] == (2, 1:2) |
| 516 | + sym, inds = vsym(var_expr), vinds(var_expr) |
| 517 | + @test sym == :(:x) |
| 518 | + @test inds == :(((2:3, 1), (2, 1:2))) |
522 | 519 |
|
523 | 520 | var_expr = :(x[2:3,2:3][[1,2],[1,2]])
|
524 |
| - sym, inds = @eval @vsym($var_expr), @vinds($var_expr) |
525 |
| - @test sym == :x |
526 |
| - @test inds[1] == (2:3, 2:3) |
527 |
| - @test inds[2] == ([1, 2], [1, 2]) |
| 521 | + sym, inds = vsym(var_expr), vinds(var_expr) |
| 522 | + @test sym == :(:x) |
| 523 | + @test inds == :(((2:3, 2:3), ([1, 2], [1, 2]))) |
528 | 524 | end
|
529 | 525 | @testset "user-defined variable name" begin
|
530 | 526 | @model f1() = begin
|
|
0 commit comments