worlddynamics / Vensim2MTK.jl

A Julia package to import Vensim .xmile files as ModelingToolkit.jl models.
MIT License
2 stars 1 forks source link

Test #19

Open meyde opened 1 year ago

meyde commented 1 year ago

We talked about tests that would help in testing if changes to the code broke anything. how should i present it? the test code is pretty simple, should i just make a test.jl file and put it in src, or do i need a test folder?

natema commented 1 year ago

You need a test folder, plz read the docs https://docs.julialang.org/en/v1/stdlib/Test/ ; you can also see an example in https://github.com/worlddynamics/WorldDynamics.jl .

meyde commented 1 year ago

would this file work in a folder named test? :

using Vensim2MTK, Test, ModelingToolkit

filepaths=["..\examples\Dice.xmile","..\examples\Lokta.xmile","..\examples\commitment2.xmile","..\examples\community corona 8.xmile"] for filepath in filepaths vensim2MTK(filepath, splitext(basename(filepath))[1] * ".jl",true) end @testset verboe=true "Vensim2MTK.jl" begin @test isa(Dice.solved, ModelingToolkit.ODESystem) @test isa(Lokta.solved, ModelingToolkit.ODESystem) @test isa(commitment.solved, ModelingToolkit.ODESystem) @test isa(community_corona_8.solved, ModelingToolkit.ODESystem) end

aurorarossi commented 1 year ago

I fixed the tests in the PR https://github.com/worlddynamics/Vensim2MTK.jl/pull/36 Dice is a file, so when you write Dice.solved you are not accessing the solved variable.