Skip to content

Commit 2a195b2

Browse files
test: add test for Tables.jl interface using MTK variable names
1 parent 1b7b148 commit 2a195b2

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

test/downstream/tables.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using ModelingToolkit, OrdinaryDiffEq, Tables, Test
2+
using ModelingToolkit: t_nounits as t, D_nounits as D
3+
4+
@variables x(t) y(t)
5+
@parameters p q
6+
@mtkbuild sys = ODESystem(
7+
[D(x) ~ p * x + q * y, 0 ~ y^2 - 2x * y - 4], t, guesses = [y => 1.0])
8+
prob = ODEProblem(sys, [x => 1.0], (0.0, 5.0), [p => 1.0, q => 2.0])
9+
sol = solve(prob, Rodas5P())
10+
11+
@test sort(collect(Tables.columnnames(Tables.columns(sol)))) ==
12+
[:timestamp, Symbol("x(t)"), Symbol("y(t)")]

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ end
115115
@time @safetestset "ODE Solution Stripping" begin
116116
include("downstream/ode_stripping.jl")
117117
end
118+
@time @safetestset "Tables interface with MTK" begin
119+
include("downstream/tables.jl")
120+
end
118121
end
119122

120123
if !is_APPVEYOR && (GROUP == "Downstream" || GROUP == "SymbolicIndexingInterface")

0 commit comments

Comments
 (0)