|
96 | 96 | m = ModelingToolkit.ImperativeAffect(fmfa)
|
97 | 97 | @test m isa ModelingToolkit.ImperativeAffect
|
98 | 98 | @test m.f == fmfa
|
99 |
| - @test m.obs == [] |
100 |
| - @test m.obs_syms == [] |
101 |
| - @test m.modified == [] |
102 |
| - @test m.mod_syms == [] |
| 99 | + @test m.observed == (;) |
| 100 | + @test m.modified == (;) |
103 | 101 | @test m.ctx === nothing
|
104 | 102 |
|
105 | 103 | m = ModelingToolkit.ImperativeAffect(fmfa, (;))
|
106 | 104 | @test m isa ModelingToolkit.ImperativeAffect
|
107 | 105 | @test m.f == fmfa
|
108 |
| - @test m.obs == [] |
109 |
| - @test m.obs_syms == [] |
110 |
| - @test m.modified == [] |
111 |
| - @test m.mod_syms == [] |
| 106 | + @test m.observed == (;) |
| 107 | + @test m.modified == (;) |
112 | 108 | @test m.ctx === nothing
|
113 | 109 |
|
114 | 110 | m = ModelingToolkit.ImperativeAffect(fmfa, (; x))
|
115 | 111 | @test m isa ModelingToolkit.ImperativeAffect
|
116 | 112 | @test m.f == fmfa
|
117 |
| - @test isequal(m.obs, []) |
118 |
| - @test m.obs_syms == [] |
119 |
| - @test isequal(m.modified, [x]) |
120 |
| - @test m.mod_syms == [:x] |
| 113 | + @test m.observed == (;) |
| 114 | + @test m.modified == (; x) |
121 | 115 | @test m.ctx === nothing
|
122 | 116 |
|
123 | 117 | m = ModelingToolkit.ImperativeAffect(fmfa, (; y = x))
|
124 | 118 | @test m isa ModelingToolkit.ImperativeAffect
|
125 | 119 | @test m.f == fmfa
|
126 |
| - @test isequal(m.obs, []) |
127 |
| - @test m.obs_syms == [] |
128 |
| - @test isequal(m.modified, [x]) |
129 |
| - @test m.mod_syms == [:y] |
| 120 | + @test m.observed == (;) |
| 121 | + @test m.modified == (; y = x) |
130 | 122 | @test m.ctx === nothing
|
131 | 123 |
|
132 | 124 | m = ModelingToolkit.ImperativeAffect(fmfa; observed = (; y = x))
|
133 | 125 | @test m isa ModelingToolkit.ImperativeAffect
|
134 | 126 | @test m.f == fmfa
|
135 |
| - @test isequal(m.obs, [x]) |
136 |
| - @test m.obs_syms == [:y] |
137 |
| - @test m.modified == [] |
138 |
| - @test m.mod_syms == [] |
| 127 | + @test m.observed == (; y = x) |
| 128 | + @test m.modified == (;) |
139 | 129 | @test m.ctx === nothing
|
140 | 130 |
|
141 | 131 | m = ModelingToolkit.ImperativeAffect(fmfa; modified = (; x))
|
142 | 132 | @test m isa ModelingToolkit.ImperativeAffect
|
143 | 133 | @test m.f == fmfa
|
144 |
| - @test isequal(m.obs, []) |
145 |
| - @test m.obs_syms == [] |
146 |
| - @test isequal(m.modified, [x]) |
147 |
| - @test m.mod_syms == [:x] |
| 134 | + @test m.observed == (;) |
| 135 | + @test m.modified == (; x) |
148 | 136 | @test m.ctx === nothing
|
149 | 137 |
|
150 | 138 | m = ModelingToolkit.ImperativeAffect(fmfa; modified = (; y = x))
|
151 | 139 | @test m isa ModelingToolkit.ImperativeAffect
|
152 | 140 | @test m.f == fmfa
|
153 |
| - @test isequal(m.obs, []) |
154 |
| - @test m.obs_syms == [] |
155 |
| - @test isequal(m.modified, [x]) |
156 |
| - @test m.mod_syms == [:y] |
| 141 | + @test m.observed == (;) |
| 142 | + @test m.modified == (; y = x) |
157 | 143 | @test m.ctx === nothing
|
158 | 144 |
|
159 | 145 | m = ModelingToolkit.ImperativeAffect(fmfa, (; x), (; x))
|
160 | 146 | @test m isa ModelingToolkit.ImperativeAffect
|
161 | 147 | @test m.f == fmfa
|
162 |
| - @test isequal(m.obs, [x]) |
163 |
| - @test m.obs_syms == [:x] |
164 |
| - @test isequal(m.modified, [x]) |
165 |
| - @test m.mod_syms == [:x] |
| 148 | + @test m.observed == (; x) |
| 149 | + @test m.modified == (; x) |
166 | 150 | @test m.ctx === nothing
|
167 | 151 |
|
168 | 152 | m = ModelingToolkit.ImperativeAffect(fmfa, (; y = x), (; y = x))
|
169 | 153 | @test m isa ModelingToolkit.ImperativeAffect
|
170 | 154 | @test m.f == fmfa
|
171 |
| - @test isequal(m.obs, [x]) |
172 |
| - @test m.obs_syms == [:y] |
173 |
| - @test isequal(m.modified, [x]) |
174 |
| - @test m.mod_syms == [:y] |
| 155 | + @test m.observed == (; y = x) |
| 156 | + @test m.modified == (; y = x) |
175 | 157 | @test m.ctx === nothing
|
176 | 158 |
|
177 | 159 | m = ModelingToolkit.ImperativeAffect(
|
178 | 160 | fmfa; modified = (; y = x), observed = (; y = x))
|
179 | 161 | @test m isa ModelingToolkit.ImperativeAffect
|
180 | 162 | @test m.f == fmfa
|
181 |
| - @test isequal(m.obs, [x]) |
182 |
| - @test m.obs_syms == [:y] |
183 |
| - @test isequal(m.modified, [x]) |
184 |
| - @test m.mod_syms == [:y] |
| 163 | + @test m.observed == (; y = x) |
| 164 | + @test m.modified == (; y = x) |
185 | 165 | @test m.ctx === nothing
|
186 | 166 |
|
187 | 167 | m = ModelingToolkit.ImperativeAffect(
|
188 | 168 | fmfa; modified = (; y = x), observed = (; y = x), ctx = 3)
|
189 | 169 | @test m isa ModelingToolkit.ImperativeAffect
|
190 | 170 | @test m.f == fmfa
|
191 |
| - @test isequal(m.obs, [x]) |
192 |
| - @test m.obs_syms == [:y] |
193 |
| - @test isequal(m.modified, [x]) |
194 |
| - @test m.mod_syms == [:y] |
| 171 | + @test m.observed == (; y = x) |
| 172 | + @test m.modified == (; y = x) |
195 | 173 | @test m.ctx === 3
|
196 | 174 |
|
197 | 175 | m = ModelingToolkit.ImperativeAffect(fmfa, (; x), (; x), 3)
|
198 | 176 | @test m isa ModelingToolkit.ImperativeAffect
|
199 | 177 | @test m.f == fmfa
|
200 |
| - @test isequal(m.obs, [x]) |
201 |
| - @test m.obs_syms == [:x] |
202 |
| - @test isequal(m.modified, [x]) |
203 |
| - @test m.mod_syms == [:x] |
| 178 | + @test m.observed == (; x) |
| 179 | + @test m.modified == (; x) |
204 | 180 | @test m.ctx === 3
|
205 | 181 | end
|
206 | 182 |
|
|
966 | 942 | end)
|
967 | 943 | @named sys = System(eqs, t, [temp], params; continuous_events = [furnace_off])
|
968 | 944 | ss = mtkcompile(sys)
|
969 |
| - @test_logs (:warn, |
970 |
| - "The symbols Any[:furnace_on] are declared as both observed and modified; this is a code smell because it becomes easy to confuse them and assign/not assign a value.") prob=ODEProblem( |
| 945 | + @test_warn "The symbols [:furnace_on] are declared as both observed and modified; this is a code smell because it becomes easy to confuse them and assign/not assign a value." prob=ODEProblem( |
971 | 946 | ss, [temp => 0.0, furnace_on => true], (0.0, 100.0))
|
972 | 947 |
|
973 | 948 | @variables tempsq(t) # trivially eliminated
|
|
1010 | 985 | ss = mtkcompile(sys)
|
1011 | 986 | prob = ODEProblem(
|
1012 | 987 | ss, [temp => 0.0, furnace_on => true], (0.0, 100.0))
|
1013 |
| - @test_throws "Tried to write back to" solve(prob, Tsit5()) |
| 988 | + @test_throws "Invalid name" solve(prob, Tsit5()) |
1014 | 989 | end
|
1015 | 990 |
|
1016 | 991 | @testset "Quadrature" begin
|
|
0 commit comments