Skip to content

Commit f543c86

Browse files
Symbolic indexing interface tests
1 parent ae039e3 commit f543c86

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using RecursiveArrayTools, Test
2+
3+
sc = SymbolCache(nothing, nothing, nothing)
4+
@test isempty(independent_variables(sc))
5+
@test !is_indep_sym(sc, :a)
6+
@test isempty(states(sc))
7+
@test isnothing(state_sym_to_index(sc, :a))
8+
@test !is_state_sym(sc, :a)
9+
@test isempty(parameters(sc))
10+
@test isnothing(param_sym_to_index(sc, :a))
11+
@test !is_param_sym(sc, :a)
12+
13+
sc = SymbolCache([:a, :b], [:t], [:c, :d])
14+
@test independent_variables(sc) == [:t]
15+
@test is_indep_sym(sc, :t)
16+
@test !is_indep_sym(sc, :a)
17+
@test states(sc) == [:a, :b]
18+
@test state_sym_to_index(sc, :a) == 1
19+
@test state_sym_to_index(sc, :b) == 2
20+
@test isnothing(state_sym_to_index(sc, :t))
21+
@test all(is_state_sym.((sc,), [:a, :b]))
22+
@test !is_state_sym(sc, :c)
23+
@test parameters(sc) == [:c, :d]
24+
@test param_sym_to_index(sc, :c) == 1
25+
@test param_sym_to_index(sc, :d) == 2
26+
@test isnothing(param_sym_to_index(sc, :a))
27+
@test all(is_param_sym.((sc,), [:c, :d]))
28+
@test !is_param_sym(sc, :b)

0 commit comments

Comments
 (0)