Skip to content

Commit

Permalink
Fix some odd test choices
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Mar 1, 2024
1 parent 96bfc35 commit 8f2c780
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/systems/nonlinear/initializesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function generate_initializesystem(sys::ODESystem;
if u0map === nothing || isempty(u0map)
filtered_u0 = u0map

Check warning on line 34 in src/systems/nonlinear/initializesystem.jl

View check run for this annotation

Codecov / codecov/patch

src/systems/nonlinear/initializesystem.jl#L32-L34

Added lines #L32 - L34 were not covered by tests
else
filtered_u0 = []
filtered_u0 = Pair[]
for x in u0map
y = get(schedule.dummy_sub, x[1], x[1])
y = get(diffmap, y, y)
Expand All @@ -51,10 +51,9 @@ function generate_initializesystem(sys::ODESystem;
elseif y set_full_states
push!(filtered_u0, y => x[2])

Check warning on line 52 in src/systems/nonlinear/initializesystem.jl

View check run for this annotation

Codecov / codecov/patch

src/systems/nonlinear/initializesystem.jl#L50-L52

Added lines #L50 - L52 were not covered by tests
else
error("Unreachable. Open an issue")
error("Initialization expression $y is currently not supported. If its a higher order derivative expression, then only the dummy derivative expressions are supported.")

Check warning on line 54 in src/systems/nonlinear/initializesystem.jl

View check run for this annotation

Codecov / codecov/patch

src/systems/nonlinear/initializesystem.jl#L54

Added line #L54 was not covered by tests
end
end
filtered_u0 = reduce(vcat, filtered_u0)
filtered_u0 = filtered_u0 isa Pair ? todict([filtered_u0]) : todict(filtered_u0)

Check warning on line 57 in src/systems/nonlinear/initializesystem.jl

View check run for this annotation

Codecov / codecov/patch

src/systems/nonlinear/initializesystem.jl#L56-L57

Added lines #L56 - L57 were not covered by tests
end
else
Expand Down
3 changes: 2 additions & 1 deletion test/odesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,8 @@ let
@test isapprox(sol[x[1]][end], 2, atol = 1e-3)

# no initial conditions for D(x[1]) and D(x[2]) provided
@test_throws ArgumentError prob=DAEProblem(sys, Pair[], Pair[], (0, 50))
@test_throws ModelingToolkit.MissingVariablesError prob=DAEProblem(
sys, Pair[], Pair[], (0, 50))

prob = ODEProblem(sys, Pair[x[1] => 0], (0, 50))
sol = solve(prob, Rosenbrock23())
Expand Down
4 changes: 0 additions & 4 deletions test/structural_transformation/index_reduction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@ let sys = structural_simplify(pendulum2)
@test length(unknowns(sys)) == 5

u0 = [
D(x) => 0.0,
D(D(x)) => 0.0,
D(y) => 0.0,
D(D(y)) => 0.0,
x => sqrt(2) / 2,
y => sqrt(2) / 2
]
Expand Down

0 comments on commit 8f2c780

Please sign in to comment.