Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LCSB-BioCore
SBML.jl
Commits
dac269e5
Unverified
Commit
dac269e5
authored
Aug 03, 2021
by
Miroslav Kratochvil
🚴
Committed by
GitHub
Aug 03, 2021
Browse files
Merge pull request #141 from anandijain/aj/rational
rational mathval
parents
b498d676
30f3426b
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/math.jl
View file @
dac269e5
...
...
@@ -57,6 +57,11 @@ function parse_math(ast::VPtr)::Math
return
MathConst
(
get_string
(
ast
,
:
ASTNode_getName
))
elseif
ast_is
(
ast
,
:
ASTNode_isInteger
)
return
MathVal
(
ccall
(
sbml
(
:
ASTNode_getInteger
),
Cint
,
(
VPtr
,),
ast
))
elseif
ast_is
(
ast
,
:
ASTNode_isRational
)
return
MathVal
(
ccall
(
sbml
(
:
ASTNode_getNumerator
),
Cint
,
(
VPtr
,),
ast
)
//
ccall
(
sbml
(
:
ASTNode_getDenominator
),
Cint
,
(
VPtr
,),
ast
),
)
elseif
ast_is
(
ast
,
:
ASTNode_isReal
)
return
MathVal
(
ccall
(
sbml
(
:
ASTNode_getReal
),
Cdouble
,
(
VPtr
,),
ast
))
elseif
ast_is
(
ast
,
:
ASTNode_isFunction
)
...
...
test/data/.gitignore
View file @
dac269e5
# Input files needed when running the tests will be downloaded here
/*.xml
!/custom.xml
test/data/
units
.xml
→
test/data/
custom
.xml
View file @
dac269e5
...
...
@@ -14,5 +14,14 @@
</listOfUnits>
</unitDefinition>
</listOfUnitDefinitions>
<listOfReactions>
<reaction
id=
"rationalTest"
reversible=
"false"
fast=
"false"
>
<kineticLaw>
<math
xmlns=
"http://www.w3.org/1998/Math/MathML"
>
<cn
type=
"rational"
>
1
<sep
/>
5000
</cn>
</math>
</kineticLaw>
</reaction>
</listOfReactions>
</model>
</sbml>
test/loadmodels.jl
View file @
dac269e5
...
...
@@ -128,7 +128,7 @@ end
@test
m
.
units
[
"time"
]
==
1
*
u
"s"
@test
m
.
units
[
"substance"
]
==
1
*
u
"mol"
m
=
readSBML
(
joinpath
(
@__DIR__
,
"data"
,
"
units
.xml"
))
m
=
readSBML
(
joinpath
(
@__DIR__
,
"data"
,
"
custom
.xml"
))
@test
m
.
units
[
"non_existent"
]
==
0.00314
@test
m
.
units
[
"no_dimensions"
]
==
20.0
end
...
...
@@ -174,6 +174,11 @@ end
@test
isequal
(
convert
(
Num
,
m
.
reactions
[
"J29"
]
.
kinetic_math
),
2.0
*
S29
*
S29b
)
end
@testset
"rationals in math"
begin
m
=
readSBML
(
joinpath
(
@__DIR__
,
"data"
,
"custom.xml"
))
@test
m
.
reactions
[
"rationalTest"
]
.
kinetic_math
.
val
==
1
//
5000
end
@testset
"converters work and fail gracefully"
begin
@test_logs
(
:
error
,
r
"^SBML reported error:"
)
(
:
error
,
r
"^SBML reported error:"
)
@test_throws
ErrorException
readSBML
(
joinpath
(
@__DIR__
,
"data"
,
"sbml01289.xml"
),
...
...
cylon-x
🤖
@cylon-x
mentioned in commit
b84b8ebb
·
Aug 03, 2021
mentioned in commit
b84b8ebb
mentioned in commit b84b8ebb6fbd6f1483203b703bcf2c1c1a81fca2
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment