symbolics.jl 1.05 KB
Newer Older
paulflang's avatar
paulflang committed
1
2

@testset "Math to Symbolics conversions" begin
3
    @variables A B C D Time
paulflang's avatar
paulflang committed
4

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
    test = SBML.MathApply(
        "*",
        SBML.Math[
            SBML.MathApply(
                "+",
                SBML.Math[
                    SBML.MathApply(
                        "*",
                        SBML.Math[SBML.MathIdent("A"), SBML.MathIdent("B")],
                    ),
                    SBML.MathApply(
                        "-",
                        SBML.Math[SBML.MathApply(
                            "*",
                            SBML.Math[SBML.MathIdent("C"), SBML.MathIdent("D")],
                        )],
                    ),
                ],
            ),
24
            SBML.MathTime("Time"),
25
26
        ],
    )
paulflang's avatar
paulflang committed
27

28
    @test isequal(convert(Num, test), (A * B - C * D) * Time)
Miroslav Kratochvil's avatar
Miroslav Kratochvil committed
29
30
31
32
33

    test = SBML.MathApply(
        "piecewise",
        SBML.Math[
            SBML.MathVal(123),
34
            SBML.MathApply("lt", SBML.Math[SBML.MathVal(1), SBML.MathVal(0)]),
Miroslav Kratochvil's avatar
Miroslav Kratochvil committed
35
36
37
38
39
            SBML.MathVal(456),
        ],
    )

    @test isequal(convert(Num, test), 456)
40
end