Skip to content

Commit b320a83

Browse files
committed
Fix such taht W2Julia(W2Julia(X)) = W2Julia(X)
1 parent 02f0f0f commit b320a83

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "MathLink"
22
uuid = "18c93696-a329-5786-9845-8443133fa0b4"
3-
version = "0.5.3"
3+
version = "0.5.4"
44

55
[deps]
66
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"

src/W2Julia.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
export W2Julia
44

5+
W2Julia(X::Vector) = [ W2Julia(x) for x in X]
6+
function W2Julia(X::Dict)
7+
NewDict = Dict()
8+
for key in keys(X)
9+
NewDict[key] = W2Julia(X[key])
10+
end
11+
return NewDict
12+
end
13+
14+
15+
516
W2Julia(X::Number) = X
617
W2Julia(X::String) = X
718
W2Julia(X::MathLink.WSymbol) = X

test/runtests.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ import MathLink: WExpr, WSymbol
99

1010
@testset "Lists to Lists" begin
1111
@test W2Julia(W`{1,2,3}`) == [1,2,3]
12+
@test W2Julia([1,2,3]) == [1,2,3]
13+
@test W2Julia([1,2.2,3]) == [1,2.2,3]
1214
@test W2Julia(W`{1,a,3}`) == [1,W"a",3]
1315
@test W2Julia(W`{1,a,{1,2}}`) == [1,W"a",[1,2]]
16+
@test W2Julia([.1,W`{1,a,3}`]) == [.1,[1,W"a",3]]
17+
1418
end
1519
@testset "Association to Dict" begin
20+
@test W2Julia(Dict( 1 => "A" , "B" => 2)) ==Dict( 1 => "A" , "B" => 2)
21+
1622
@test W2Julia(W`Association["team" -> "HOU", "lastName" -> "Ching"]`) == Dict( "team" => "HOU" , "lastName" => "Ching")
1723
end
1824
@testset "Association and List Dict" begin

0 commit comments

Comments
 (0)