Skip to content

Commit 16cabcd

Browse files
committed
Remove redundant tests
1 parent 2bc1930 commit 16cabcd

File tree

4 files changed

+10
-142
lines changed

4 files changed

+10
-142
lines changed

test/components.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ rc_eqs = [
8181
]
8282

8383
rc_model = ODESystem(rc_eqs, t, systems=[resistor, capacitor, source, ground], name=:rc)
84-
sys = alias_elimination(rc_model)
84+
sys = structural_simplify(rc_model)
8585
@test ModelingToolkit.default_p(sys) == Dict(
8686
capacitor.C => 1.0,
8787
source.V => 1.0,
@@ -95,6 +95,15 @@ u0 = [
9595
prob = ODEProblem(sys, u0, (0, 10.0))
9696
sol = solve(prob, Rodas4())
9797

98+
@test sol[resistor.p.i] == sol[capacitor.p.i]
99+
@test sol[resistor.n.i] == -sol[capacitor.p.i]
100+
@test sol[capacitor.n.i] == -sol[capacitor.p.i]
101+
@test iszero(sol[ground.g.i])
102+
@test iszero(sol[ground.g.v])
103+
104+
prob = ODAEProblem(sys, u0, (0, 10.0))
105+
sol = solve(prob, Rodas4())
106+
98107
@test sol[resistor.p.i] == sol[capacitor.p.i]
99108
@test sol[resistor.n.i] == -sol[capacitor.p.i]
100109
@test sol[capacitor.n.i] == -sol[capacitor.p.i]

test/dep_graphs.jl

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -102,39 +102,3 @@ ns = NonlinearSystem(eqs, [x,y,z],[σ,ρ,β])
102102
deps = equation_dependencies(ns)
103103
eq_sdeps = [[x,y],[y],[y,z]]
104104
@test all(i -> isequal(Set(deps[i]),Set(value.(eq_sdeps[i]))), 1:length(deps))
105-
106-
using SparseArrays
107-
using ModelingToolkit
108-
using UnPack
109-
110-
# Define some variables
111-
@parameters t L g
112-
@variables x(t) y(t) w(t) z(t) T(t)
113-
D = Differential(t)
114-
115-
# Simple pendulum in cartesian coordinates
116-
eqs = [D(x) ~ w,
117-
D(y) ~ z,
118-
D(w) ~ T*x,
119-
D(z) ~ T*y - g,
120-
0 ~ x^2 + y^2 - L^2]
121-
pendulum = ODESystem(eqs, t, [x, y, w, z, T], [L, g], name=:pendulum)
122-
sys = initialize_system_structure(pendulum)
123-
sss = structure(sys)
124-
@unpack graph, fullvars, varassoc = sss
125-
@test isequal(fullvars, [x, y, w, z, D(x), D(y), D(w), D(z), T])
126-
@test graph.fadjlist == sort.([[5, 3], [6, 4], [7, 1, 9], [8, 2, 9], [2, 1]])
127-
@test graph.badjlist == sort.([[3, 5], [4, 5], [1], [2], [1], [2], [3], [4], [3, 4]])
128-
@test LightGraphs.ne(graph) == nnz(incidence_matrix(graph)) == 12
129-
@test varassoc == [5, 6, 7, 8, 0, 0, 0, 0, 0]
130-
131-
se = collect(ModelingToolkit.𝑠edges(graph))
132-
@test se == mapreduce(vcat, enumerate(graph.fadjlist)) do (s, d)
133-
ModelingToolkit.BipartiteEdge.(s, d)
134-
end
135-
de = collect(ModelingToolkit.𝑑edges(graph))
136-
@test de == mapreduce(vcat, enumerate(graph.badjlist)) do (d, s)
137-
ModelingToolkit.BipartiteEdge.(s, d)
138-
end
139-
ae = collect(ModelingToolkit.edges(graph))
140-
@test ae == vcat(se, de)

test/structural_transformation/components.jl

Lines changed: 0 additions & 104 deletions
This file was deleted.

test/structural_transformation/runtests.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ using SafeTestsets
33
@safetestset "Utilities" begin include("utils.jl") end
44
@safetestset "Index Reduction & SCC" begin include("index_reduction.jl") end
55
@safetestset "Tearing" begin include("tearing.jl") end
6-
@safetestset "Components" begin include("components.jl") end

0 commit comments

Comments
 (0)