Skip to content

Commit a1268c1

Browse files
test: add test for alias elimination swapping differential variables
1 parent c49d619 commit a1268c1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/reduction.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,3 +347,9 @@ ss = alias_elimination(sys)
347347
@test length(equations(ss)) == length(unknowns(ss)) == 1
348348
ss = mtkcompile(sys)
349349
@test length(equations(ss)) == length(unknowns(ss)) == 2
350+
351+
@testset "Aliases of differential variables with higher state priority are swapped" begin
352+
@variables x(t) y(t)
353+
@mtkcompile sys = System([D(x) ~ 2x, y ~ x], t; state_priorities = [y => 10])
354+
@test isequal(only(unknowns(sys)), y)
355+
end

0 commit comments

Comments
 (0)