Skip to content

Commit ee20e48

Browse files
test: update tests to use ImperativeAffect
1 parent 9d0838b commit ee20e48

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

test/symbolic_events.jl

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,8 +1067,7 @@ end
10671067
@testset "Initialization" begin
10681068
@variables x(t)
10691069
seen = false
1070-
f = ModelingToolkit.FunctionalAffect(
1071-
f = (i, u, p, c) -> seen = true, sts = [], pars = [], discretes = [])
1070+
f = ModelingToolkit.ImperativeAffect(f = (o, m, ctx, int) -> seen = true)
10721071
cb1 = ModelingToolkit.SymbolicContinuousCallback(
10731072
[x ~ 0], nothing, initialize = [x ~ 1.5], finalize = f)
10741073
@mtkbuild sys = System(D(x) ~ -1, t, [x], []; continuous_events = [cb1])
@@ -1080,16 +1079,13 @@ end
10801079

10811080
@variables x(t)
10821081
seen = false
1083-
f = ModelingToolkit.FunctionalAffect(
1084-
f = (i, u, p, c) -> seen = true, sts = [], pars = [], discretes = [])
1082+
f = ModelingToolkit.ImperativeAffect(f = (o, m, ctx, int) -> seen = true)
10851083
cb1 = ModelingToolkit.SymbolicContinuousCallback(
10861084
[x ~ 0], nothing, initialize = [x ~ 1.5], finalize = f)
10871085
inited = false
10881086
finaled = false
1089-
a = ModelingToolkit.FunctionalAffect(
1090-
f = (i, u, p, c) -> inited = true, sts = [], pars = [], discretes = [])
1091-
b = ModelingToolkit.FunctionalAffect(
1092-
f = (i, u, p, c) -> finaled = true, sts = [], pars = [], discretes = [])
1087+
a = ModelingToolkit.ImperativeAffect(f = (o, m, ctx, int) -> inited = true)
1088+
b = ModelingToolkit.ImperativeAffect(f = (o, m, ctx, int) -> finaled = true)
10931089
cb2 = ModelingToolkit.SymbolicContinuousCallback(
10941090
[x ~ 0.1], nothing, initialize = a, finalize = b)
10951091
@mtkbuild sys = System(D(x) ~ -1, t, [x], []; continuous_events = [cb1, cb2])

0 commit comments

Comments
 (0)