Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions test/clock.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,22 @@ k = ShiftIndex(d)
[yd(k + 1) ~ Sample(dt)(y); r(k + 1) ~ 1.0;
ud(k + 1) ~ kp * (r(k + 1) - yd(k + 1))])

canonical_eqs = map(eqs) do eq
if iscall(eq.lhs) && operation(eq.lhs) isa Differential
return eq
else
return 0 ~ eq.rhs - eq.lhs
end
end
eqs_idxs = findfirst.(isequal.(canonical_eqs), (equations(ci.ts),))
d = Clock(dt)
# Note that TearingState reorders the equations
@test eqmap[1] == ContinuousClock()
@test eqmap[2] == d
@test eqmap[3] == d
@test eqmap[4] == d
@test eqmap[5] == ContinuousClock()
@test eqmap[6] == ContinuousClock()
@test eqmap[eqs_idxs[1]] == d
@test eqmap[eqs_idxs[2]] == d
@test eqmap[eqs_idxs[3]] == d
@test eqmap[eqs_idxs[4]] == ContinuousClock()
@test eqmap[eqs_idxs[5]] == ContinuousClock()
@test eqmap[eqs_idxs[6]] == ContinuousClock()

@test varmap[yd] == d
@test varmap[ud] == d
Expand Down
Loading