You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(121) |
Aug
(343) |
Sep
(98) |
Oct
(55) |
Nov
(158) |
Dec
(219) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(278) |
Feb
(170) |
Mar
(286) |
Apr
(32) |
May
(83) |
Jun
(140) |
Jul
(212) |
Aug
(242) |
Sep
(52) |
Oct
(29) |
Nov
(132) |
Dec
(259) |
| 2010 |
Jan
(251) |
Feb
(147) |
Mar
(76) |
Apr
(140) |
May
(43) |
Jun
(66) |
Jul
(273) |
Aug
(205) |
Sep
(260) |
Oct
(100) |
Nov
(58) |
Dec
(264) |
| 2011 |
Jan
(219) |
Feb
(344) |
Mar
(320) |
Apr
(334) |
May
(125) |
Jun
(131) |
Jul
(195) |
Aug
(155) |
Sep
(55) |
Oct
(261) |
Nov
(286) |
Dec
(216) |
| 2012 |
Jan
(188) |
Feb
(177) |
Mar
(39) |
Apr
(179) |
May
(148) |
Jun
(43) |
Jul
(229) |
Aug
(104) |
Sep
(76) |
Oct
(82) |
Nov
(93) |
Dec
(180) |
| 2013 |
Jan
(323) |
Feb
(335) |
Mar
(35) |
Apr
(220) |
May
(238) |
Jun
(122) |
Jul
(316) |
Aug
(73) |
Sep
(135) |
Oct
(515) |
Nov
(320) |
Dec
(185) |
| 2014 |
Jan
(81) |
Feb
(146) |
Mar
(337) |
Apr
(234) |
May
(112) |
Jun
(239) |
Jul
(323) |
Aug
(123) |
Sep
(83) |
Oct
(285) |
Nov
(321) |
Dec
(96) |
| 2015 |
Jan
(77) |
Feb
(79) |
Mar
(124) |
Apr
(71) |
May
(35) |
Jun
(45) |
Jul
(77) |
Aug
(44) |
Sep
(22) |
Oct
(84) |
Nov
(120) |
Dec
(37) |
| 2016 |
Jan
(38) |
Feb
(74) |
Mar
(242) |
Apr
(153) |
May
(59) |
Jun
(44) |
Jul
(67) |
Aug
(74) |
Sep
(150) |
Oct
(35) |
Nov
(69) |
Dec
(43) |
| 2017 |
Jan
(43) |
Feb
(9) |
Mar
(274) |
Apr
(40) |
May
(81) |
Jun
(81) |
Jul
(87) |
Aug
(46) |
Sep
(98) |
Oct
(50) |
Nov
(220) |
Dec
(66) |
| 2018 |
Jan
(110) |
Feb
(22) |
Mar
(20) |
Apr
(147) |
May
(148) |
Jun
(30) |
Jul
(83) |
Aug
(63) |
Sep
(40) |
Oct
(53) |
Nov
(51) |
Dec
(104) |
| 2019 |
Jan
(14) |
Feb
(81) |
Mar
(80) |
Apr
(102) |
May
(16) |
Jun
(5) |
Jul
(34) |
Aug
(24) |
Sep
(9) |
Oct
(12) |
Nov
(42) |
Dec
(76) |
| 2020 |
Jan
(15) |
Feb
(11) |
Mar
(12) |
Apr
(7) |
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2021 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
1
(1) |
2
|
3
(7) |
4
(15) |
5
(8) |
6
(6) |
7
(2) |
|
8
|
9
(8) |
10
(4) |
11
(9) |
12
(13) |
13
(1) |
14
|
|
15
(2) |
16
(6) |
17
(13) |
18
(14) |
19
(13) |
20
(5) |
21
(2) |
|
22
(5) |
23
(8) |
24
(2) |
25
(11) |
26
(9) |
27
(6) |
28
|
|
29
(1) |
30
(1) |
31
(16) |
|
|
|
|
|
From: <sar...@us...> - 2012-01-31 13:30:58
|
Revision: 15346
http://sbml.svn.sourceforge.net/sbml/?rev=15346&view=rev
Author: sarahkeating
Date: 2012-01-31 13:30:48 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
reading/writing of piecewise with silly arguments was not being done correctly - it is now
Modified Paths:
--------------
trunk/libsbml/src/sbml/math/MathML.cpp
trunk/libsbml/src/sbml/math/test/TestReadMathML.cpp
trunk/libsbml/src/sbml/validator/constraints/MathMLBase.cpp
trunk/libsbml/src/sbml/validator/constraints/NumberArgsMathCheck.cpp
trunk/libsbml/src/sbml/validator/constraints/NumberArgsMathCheck.h
Added Paths:
-----------
trunk/libsbml/src/sbml/validator/test/test-data/sbml-mathml-constraints/10218-fail-01-08.xml
trunk/libsbml/src/sbml/validator/test/test-data/sbml-mathml-constraints/10218-fail-01-09.xml
trunk/libsbml/src/sbml/validator/test/test-data/sbml-mathml-constraints/10218-pass-00-15.xml
trunk/libsbml/src/sbml/validator/test/test-data/sbml-mathml-constraints/10218-pass-00-16.xml
Modified: trunk/libsbml/src/sbml/math/MathML.cpp
===================================================================
--- trunk/libsbml/src/sbml/math/MathML.cpp 2012-01-31 12:31:56 UTC (rev 15345)
+++ trunk/libsbml/src/sbml/math/MathML.cpp 2012-01-31 13:30:48 UTC (rev 15346)
@@ -803,12 +803,13 @@
else
{
/* catch case where there is no otherwise
+ * BUT do not return if we are dealing with <piecewise/>
*/
- if (elem.isEnd())
- {
- //node = NULL;
- return;
- }
+ //if (elem.isEnd())
+ //{
+ // //node = NULL;
+ // return;
+ //}
node.setType(AST_FUNCTION_PIECEWISE);
}
Modified: trunk/libsbml/src/sbml/math/test/TestReadMathML.cpp
===================================================================
--- trunk/libsbml/src/sbml/math/test/TestReadMathML.cpp 2012-01-31 12:31:56 UTC (rev 15345)
+++ trunk/libsbml/src/sbml/math/test/TestReadMathML.cpp 2012-01-31 13:30:48 UTC (rev 15346)
@@ -1109,6 +1109,65 @@
END_TEST
+START_TEST (test_element_piecewise_no_args_1)
+{
+ const char* s = wrapMathML
+ (
+ "<piecewise>"
+ "</piecewise>"
+ );
+
+ N = readMathMLFromString(s);
+
+ fail_unless( N != NULL );
+
+ F = SBML_formulaToString(N);
+ fail_unless( !strcmp(F, "piecewise()"),
+ NULL );
+}
+END_TEST
+
+
+START_TEST (test_element_piecewise_no_args_2)
+{
+ const char* s = wrapMathML
+ (
+ "<piecewise/>"
+ );
+
+ N = readMathMLFromString(s);
+
+ fail_unless( N != NULL );
+
+ F = SBML_formulaToString(N);
+ fail_unless( !strcmp(F, "piecewise()"),
+ NULL );
+}
+END_TEST
+
+
+START_TEST (test_element_piecewise_one_arg)
+{
+ const char* s = wrapMathML
+ (
+ "<piecewise>"
+ " <otherwise>"
+ " <ci>x</ci>"
+ " </otherwise>"
+ "</piecewise>"
+ );
+
+ N = readMathMLFromString(s);
+
+ fail_unless( N != NULL );
+
+ F = SBML_formulaToString(N);
+ fail_unless( !strcmp(F, "piecewise(x)"),
+ NULL );
+}
+END_TEST
+
+
START_TEST (test_element_power)
{
const char* s = wrapMathML("<apply><power/> <ci>x</ci> <cn>3</cn> </apply>");
@@ -1987,6 +2046,9 @@
tcase_add_test( tcase, test_element_or );
tcase_add_test( tcase, test_element_piecewise );
tcase_add_test( tcase, test_element_piecewise_otherwise );
+ tcase_add_test( tcase, test_element_piecewise_no_args_1 );
+ tcase_add_test( tcase, test_element_piecewise_no_args_2 );
+ tcase_add_test( tcase, test_element_piecewise_one_arg );
tcase_add_test( tcase, test_element_power );
tcase_add_test( tcase, test_element_root_1 );
tcase_add_test( tcase, test_element_root_2 );
Modified: trunk/libsbml/src/sbml/validator/constraints/MathMLBase.cpp
===================================================================
--- trunk/libsbml/src/sbml/validator/constraints/MathMLBase.cpp 2012-01-31 12:31:56 UTC (rev 15345)
+++ trunk/libsbml/src/sbml/validator/constraints/MathMLBase.cpp 2012-01-31 13:30:48 UTC (rev 15346)
@@ -358,8 +358,9 @@
{
numeric = checkNumericFunction(m, node);
}
- /* or possibly a plus/times with no arguments */
- else if (type == AST_PLUS || type == AST_TIMES)
+ /* or possibly a plus/times/piecewise with no arguments */
+ else if (type == AST_PLUS || type == AST_TIMES
+ || type == AST_FUNCTION_PIECEWISE)
{
numeric = true;
}
Modified: trunk/libsbml/src/sbml/validator/constraints/NumberArgsMathCheck.cpp
===================================================================
--- trunk/libsbml/src/sbml/validator/constraints/NumberArgsMathCheck.cpp 2012-01-31 12:31:56 UTC (rev 15345)
+++ trunk/libsbml/src/sbml/validator/constraints/NumberArgsMathCheck.cpp 2012-01-31 13:30:48 UTC (rev 15346)
@@ -154,10 +154,14 @@
case AST_RELATIONAL_GT:
case AST_RELATIONAL_LEQ:
case AST_RELATIONAL_LT:
- case AST_FUNCTION_PIECEWISE:
checkAtLeast2Args(m, node, sb);
break;
+ case AST_FUNCTION_PIECEWISE:
+ checkPiecewise(m, node, sb);
+ break;
+
+
case AST_FUNCTION_ROOT:
case AST_MINUS:
@@ -267,6 +271,15 @@
}
+void NumberArgsMathCheck::checkPiecewise(const Model& m,
+ const ASTNode& node, const SBase & sb)
+{
+ if (node.getNumChildren() == 0)
+ {
+ logMathConflict(node, sb);
+ }
+
+}
/**
* @return the error message to use when logging constraint violations.
* This method is called by logFailure.
Modified: trunk/libsbml/src/sbml/validator/constraints/NumberArgsMathCheck.h
===================================================================
--- trunk/libsbml/src/sbml/validator/constraints/NumberArgsMathCheck.h 2012-01-31 12:31:56 UTC (rev 15345)
+++ trunk/libsbml/src/sbml/validator/constraints/NumberArgsMathCheck.h 2012-01-31 13:30:48 UTC (rev 15346)
@@ -93,6 +93,11 @@
void checkAtLeast2Args(const Model& m, const ASTNode& node, const SBase & sb);
/**
+ * Checks that the function piecewise
+ */
+ void checkPiecewise(const Model& m, const ASTNode& node, const SBase & sb);
+
+ /**
* @return the preamble to use when logging constraint violations. The
* preamble will be prepended to each log message. If not overriden,
* returns an empty string.
Added: trunk/libsbml/src/sbml/validator/test/test-data/sbml-mathml-constraints/10218-fail-01-08.xml
===================================================================
--- trunk/libsbml/src/sbml/validator/test/test-data/sbml-mathml-constraints/10218-fail-01-08.xml (rev 0)
+++ trunk/libsbml/src/sbml/validator/test/test-data/sbml-mathml-constraints/10218-fail-01-08.xml 2012-01-31 13:30:48 UTC (rev 15346)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" level="3" version="1">
+ <model>
+ <listOfParameters>
+ <parameter id="Keq" value="2.5" units="dimensionless" constant="false"/>
+ </listOfParameters>
+ <listOfRules>
+ <assignmentRule variable="Keq">
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <piecewise>
+ </piecewise>
+ </math>
+ </assignmentRule>
+ </listOfRules>
+ </model>
+</sbml>
Added: trunk/libsbml/src/sbml/validator/test/test-data/sbml-mathml-constraints/10218-fail-01-09.xml
===================================================================
--- trunk/libsbml/src/sbml/validator/test/test-data/sbml-mathml-constraints/10218-fail-01-09.xml (rev 0)
+++ trunk/libsbml/src/sbml/validator/test/test-data/sbml-mathml-constraints/10218-fail-01-09.xml 2012-01-31 13:30:48 UTC (rev 15346)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" level="3" version="1">
+ <model>
+ <listOfConstraints>
+ <constraint>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <piecewise>
+ </piecewise>
+ </math>
+
+ </constraint>
+ </listOfConstraints>
+
+
+ </model>
+</sbml>
Added: trunk/libsbml/src/sbml/validator/test/test-data/sbml-mathml-constraints/10218-pass-00-15.xml
===================================================================
--- trunk/libsbml/src/sbml/validator/test/test-data/sbml-mathml-constraints/10218-pass-00-15.xml (rev 0)
+++ trunk/libsbml/src/sbml/validator/test/test-data/sbml-mathml-constraints/10218-pass-00-15.xml 2012-01-31 13:30:48 UTC (rev 15346)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" level="3" version="1">
+ <model>
+ <listOfParameters>
+ <parameter id="Keq" value="2.5" units="dimensionless" constant="false"/>
+ </listOfParameters>
+ <listOfRules>
+ <assignmentRule variable="Keq">
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <piecewise>
+ <otherwise>
+ <cn> 4 </cn>
+ </otherwise>
+ </piecewise>
+ </math>
+ </assignmentRule>
+ </listOfRules>
+ </model>
+</sbml>
Added: trunk/libsbml/src/sbml/validator/test/test-data/sbml-mathml-constraints/10218-pass-00-16.xml
===================================================================
--- trunk/libsbml/src/sbml/validator/test/test-data/sbml-mathml-constraints/10218-pass-00-16.xml (rev 0)
+++ trunk/libsbml/src/sbml/validator/test/test-data/sbml-mathml-constraints/10218-pass-00-16.xml 2012-01-31 13:30:48 UTC (rev 15346)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" level="3" version="1">
+ <model>
+ <listOfConstraints>
+ <constraint>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <piecewise>
+ <otherwise>
+ <true/>
+ </otherwise>
+ </piecewise>
+ </math>
+
+ </constraint>
+ </listOfConstraints>
+
+
+ </model>
+</sbml>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2012-01-31 12:32:08
|
Revision: 15345
http://sbml.svn.sourceforge.net/sbml/?rev=15345&view=rev
Author: sarahkeating
Date: 2012-01-31 12:31:56 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
added more tests for evaluation of piecewise and fixed a bug that emerged
Modified Paths:
--------------
trunk/libsbml/src/sbml/SBMLTransforms.cpp
trunk/libsbml/src/sbml/test/TestSBMLTransforms.cpp
Modified: trunk/libsbml/src/sbml/SBMLTransforms.cpp
===================================================================
--- trunk/libsbml/src/sbml/SBMLTransforms.cpp 2012-01-31 03:49:44 UTC (rev 15344)
+++ trunk/libsbml/src/sbml/SBMLTransforms.cpp 2012-01-31 12:31:56 UTC (rev 15345)
@@ -728,13 +728,29 @@
double boolean = evaluateASTNode(node->getChild(i+1), m);
if (boolean == 1.0)
{
- result = boolean;
- assigned = true;
+ // we might have two true piece statements
+ // if the values are the same - fine
+ // if not then the result is undefined
+ if (assigned == true)
+ {
+ if (value == result)
+ {
+ continue;
+ }
+ else
+ {
+ result = numeric_limits<double>::quiet_NaN();
+ }
+ }
+ else
+ {
+ result = value;
+ assigned = true;
+ }
}
}
if (!assigned)
{
- // compute otherwise
result = numeric_limits<double>::quiet_NaN();
}
}
@@ -748,9 +764,26 @@
double boolean = evaluateASTNode(node->getChild(i+1), m);
if (boolean == 1.0)
{
- result = boolean;
- assigned = true;
- }
+ // we might have two true piece statements
+ // if the values are the same - fine
+ // if not then the result is undefined
+ if (assigned == true)
+ {
+ if (value == result)
+ {
+ continue;
+ }
+ else
+ {
+ result = numeric_limits<double>::quiet_NaN();
+ }
+ }
+ else
+ {
+ result = value;
+ assigned = true;
+ }
+ }
}
if (!assigned)
{
Modified: trunk/libsbml/src/sbml/test/TestSBMLTransforms.cpp
===================================================================
--- trunk/libsbml/src/sbml/test/TestSBMLTransforms.cpp 2012-01-31 03:49:44 UTC (rev 15344)
+++ trunk/libsbml/src/sbml/test/TestSBMLTransforms.cpp 2012-01-31 12:31:56 UTC (rev 15345)
@@ -424,14 +424,6 @@
temp = 0.5 * log(3.0);
fail_unless(equalDouble(SBMLTransforms::evaluateASTNode(node), temp));
- node = SBML_parseFormula("piecewise(1.0, true, 0.0)");
- temp = 1.0;
- fail_unless(equalDouble(SBMLTransforms::evaluateASTNode(node), temp));
-
- node = SBML_parseFormula("piecewise(1.0, false, 0.0)");
- temp = 0.0;
- fail_unless(equalDouble(SBMLTransforms::evaluateASTNode(node), temp));
-
node = SBML_parseFormula("arcsech(0.2)");
temp = log(2*pow(6, 0.5)+5);
@@ -473,7 +465,38 @@
node= SBML_parseFormula("piecewise(1,true)");
fail_unless(equalDouble(SBMLTransforms::evaluateASTNode(node), 1));
+ node = SBML_parseFormula("piecewise(1.0, true, 0.0)");
+ temp = 1.0;
+ fail_unless(equalDouble(SBMLTransforms::evaluateASTNode(node), temp));
+ node = SBML_parseFormula("piecewise(1.0, false, 0.0)");
+ temp = 0.0;
+ fail_unless(equalDouble(SBMLTransforms::evaluateASTNode(node), temp));
+
+ node = SBML_parseFormula("piecewise(4.5)");
+ temp = 4.5;
+ fail_unless(equalDouble(SBMLTransforms::evaluateASTNode(node), temp));
+
+ node = SBML_parseFormula("piecewise(4.5, false, 5.5, true)");
+ temp = 5.5;
+ fail_unless(equalDouble(SBMLTransforms::evaluateASTNode(node), temp));
+
+ node = SBML_parseFormula("piecewise(4.5, true, 5.5, false)");
+ temp = 4.5;
+ fail_unless(equalDouble(SBMLTransforms::evaluateASTNode(node), temp));
+
+ node = SBML_parseFormula("piecewise(4.5, false, 5.5, false, 6.5)");
+ temp = 6.5;
+ fail_unless(equalDouble(SBMLTransforms::evaluateASTNode(node), temp));
+
+ node= SBML_parseFormula("piecewise(4.5, true, 5.5, true)");
+
+ fail_unless(isnan(SBMLTransforms::evaluateASTNode(node)));
+
+ node = SBML_parseFormula("piecewise(4.5, true, 4.5, true)");
+ temp = 4.5;
+ fail_unless(equalDouble(SBMLTransforms::evaluateASTNode(node), temp));
+
node = SBML_parseFormula("root(2, 4)");
fail_unless(equalDouble(SBMLTransforms::evaluateASTNode(node), 2));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fbe...@us...> - 2012-01-31 03:49:51
|
Revision: 15344
http://sbml.svn.sourceforge.net/sbml/?rev=15344&view=rev
Author: fbergmann
Date: 2012-01-31 03:49:44 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
- added convenience function for translating tests, to be invoked from the libsbml root dir
Added Paths:
-----------
trunk/libsbml/dev/utilities/translateTests/convertTests.sh
Added: trunk/libsbml/dev/utilities/translateTests/convertTests.sh
===================================================================
--- trunk/libsbml/dev/utilities/translateTests/convertTests.sh (rev 0)
+++ trunk/libsbml/dev/utilities/translateTests/convertTests.sh 2012-01-31 03:49:44 UTC (rev 15344)
@@ -0,0 +1,47 @@
+#!/bin/bash
+DIRECTORY=$(cd `dirname $0` && pwd)
+BASEDIR=$DIRECTORY/../../../
+cd $BASEDIR
+PERL=perl
+
+FILE=$1
+SUBDIR=
+case "$FILE" in
+ *math*)
+ SUBDIR=math
+ ;;
+ *annotation*)
+ SUBDIR=annotation
+ ;;
+ *xml*)
+ SUBDIR=xml
+ ;;
+ *sbml*)
+ SUBDIR=sbml
+ ;;
+esac
+
+if [ "$FILE" = "" ]
+then
+echo "usage: convertTests subdir testfile"
+echo ""
+echo "Converts libSBML tests into Perl, Ruby, CSharp and Java"
+echo "subdir has to be one of: math, sbml, annotation, xml"
+echo ""
+fi
+
+if [ ! -f "./configure" ];
+then
+ echo "Please run this script from the libsbml root directory."
+ exit 1
+fi
+if [ ! -f $FILE ];
+then
+ echo "File not found!"
+ exit 1
+fi
+
+$PERL ./dev/utilities/translateTests/translateTests.pl -o ./src/bindings/python/test/$SUBDIR -p $FILE
+$PERL ./dev/utilities/translateTests/translateTests.pl -o ./src/bindings/ruby/test/$SUBDIR -r $FILE
+$PERL ./dev/utilities/translateTests/translateTests.pl -o ./src/bindings/csharp/test/$SUBDIR -c $FILE
+$PERL ./dev/utilities/translateTests/translateTests.pl -o ./src/bindings/java/test/org/sbml/libsbml/test/$SUBDIR -j $FILE
Property changes on: trunk/libsbml/dev/utilities/translateTests/convertTests.sh
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fbe...@us...> - 2012-01-31 03:21:00
|
Revision: 15343
http://sbml.svn.sourceforge.net/sbml/?rev=15343&view=rev
Author: fbergmann
Date: 2012-01-31 03:20:53 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
- converted changed java tests
Modified Paths:
--------------
trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/math/TestValidASTNode.java
trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestConstraint_newSetters.java
trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestDelay.java
trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestEventAssignment_newSetters.java
trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestFunctionDefinition_newSetters.java
trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestInitialAssignment_newSetters.java
trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestKineticLaw_newSetters.java
trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestPriority.java
trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestRule_newSetters.java
trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestStoichiometryMath.java
trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestTrigger.java
Modified: trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/math/TestValidASTNode.java
===================================================================
--- trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/math/TestValidASTNode.java 2012-01-31 03:20:14 UTC (rev 15342)
+++ trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/math/TestValidASTNode.java 2012-01-31 03:20:53 UTC (rev 15343)
@@ -10,7 +10,7 @@
* DO NOT EDIT THIS FILE.
*
* This file was generated automatically by converting the file located at
- * src/math/test/TestValidASTNode.cpp
+ * src/sbml/test/TestValidASTNode.cpp
* using the conversion program dev/utilities/translateTests/translateTests.pl.
* Any changes made here will be lost the next time the file is regenerated.
*
@@ -151,6 +151,68 @@
n = null;
}
+ public void test_ValidASTNode_infix_nary_plus0()
+ {
+ ASTNode n = libsbml.readMathMLFromString("<math xmlns='http://www.w3.org/1998/Math/MathML'>" +
+ " <apply>" +
+ " <plus/>" +
+ " </apply>" +
+ "</math>");
+ assertTrue( n != null );
+ String formula = libsbml.formulaToString(n);
+ ASTNode node = libsbml.parseFormula(formula);
+ assertTrue( node != null );
+ n = null;
+ node = null;
+ }
+
+ public void test_ValidASTNode_infix_nary_plus1()
+ {
+ ASTNode n = libsbml.readMathMLFromString("<math xmlns='http://www.w3.org/1998/Math/MathML'>" +
+ " <apply>" +
+ " <plus/>" +
+ " <cn> 0 </cn>" +
+ " </apply>" +
+ "</math>");
+ assertTrue( n != null );
+ String formula = libsbml.formulaToString(n);
+ ASTNode node = libsbml.parseFormula(formula);
+ assertTrue( node != null );
+ n = null;
+ node = null;
+ }
+
+ public void test_ValidASTNode_infix_nary_times0()
+ {
+ ASTNode n = libsbml.readMathMLFromString("<math xmlns='http://www.w3.org/1998/Math/MathML'>" +
+ " <apply>" +
+ " <times/>" +
+ " </apply>" +
+ "</math>");
+ assertTrue( n != null );
+ String formula = libsbml.formulaToString(n);
+ ASTNode node = libsbml.parseFormula(formula);
+ assertTrue( node != null );
+ n = null;
+ node = null;
+ }
+
+ public void test_ValidASTNode_infix_nary_times1()
+ {
+ ASTNode n = libsbml.readMathMLFromString("<math xmlns='http://www.w3.org/1998/Math/MathML'>" +
+ " <apply>" +
+ " <times/>" +
+ " <cn> 0 </cn>" +
+ " </apply>" +
+ "</math>");
+ assertTrue( n != null );
+ String formula = libsbml.formulaToString(n);
+ ASTNode node = libsbml.parseFormula(formula);
+ assertTrue( node != null );
+ n = null;
+ node = null;
+ }
+
public void test_ValidASTNode_lambda()
{
ASTNode n = new ASTNode(libsbml.AST_LAMBDA);
@@ -169,11 +231,19 @@
public void test_ValidASTNode_nary()
{
- ASTNode n = new ASTNode(libsbml.AST_TIMES);
+ ASTNode n = new ASTNode(libsbml.AST_DIVIDE);
assertEquals( false, (n.isWellFormedASTNode()) );
ASTNode c = libsbml.parseFormula("c");
+ n.addChild(c.deepCopy());
+ assertEquals( false, (n.isWellFormedASTNode()) );
+ n.addChild(c.deepCopy());
+ assertEquals( true, (n.isWellFormedASTNode()) );
+ n.addChild(c.deepCopy());
+ assertEquals( false, (n.isWellFormedASTNode()) );
+ n = new ASTNode(libsbml.AST_TIMES);
+ assertEquals( true, (n.isWellFormedASTNode()) );
n.addChild(c);
- assertEquals( false, (n.isWellFormedASTNode()) );
+ assertEquals( true, (n.isWellFormedASTNode()) );
ASTNode d = libsbml.parseFormula("d");
n.addChild(d);
assertEquals( true, n.isWellFormedASTNode() );
@@ -183,6 +253,36 @@
n = null;
}
+ public void test_ValidASTNode_returnsBoolean()
+ {
+ ASTNode node = new ASTNode ( libsbml.AST_LOGICAL_AND );
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_LOGICAL_NOT);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_LOGICAL_OR);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_LOGICAL_XOR);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_FUNCTION_PIECEWISE);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_RELATIONAL_EQ);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_RELATIONAL_GEQ);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_RELATIONAL_GT);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_RELATIONAL_LEQ);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_RELATIONAL_LT);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_RELATIONAL_NEQ);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_CONSTANT_TRUE);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_CONSTANT_FALSE);
+ assertEquals( true, node.returnsBoolean() );
+ }
+
public void test_ValidASTNode_root()
{
ASTNode n = new ASTNode(libsbml.AST_FUNCTION_ROOT);
@@ -284,4 +384,3 @@
}
}
}
-
Modified: trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestConstraint_newSetters.java
===================================================================
--- trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestConstraint_newSetters.java 2012-01-31 03:20:14 UTC (rev 15342)
+++ trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestConstraint_newSetters.java 2012-01-31 03:20:53 UTC (rev 15343)
@@ -1,10 +1,9 @@
/*
* @file TestConstraint_newSetters.java
- * @brief Constraint unit tests for new set function API
+ * @brief Constraint unit tests for new set function API
*
* @author Akiya Jouraku (Java conversion)
- * @author Sarah Keating
-
+ * @author Sarah Keating
*
* ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
*
@@ -149,7 +148,7 @@
public void test_Constraint_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
int i = C.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, C.isSetMath() );
@@ -249,4 +248,3 @@
}
}
}
-
Modified: trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestDelay.java
===================================================================
--- trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestDelay.java 2012-01-31 03:20:14 UTC (rev 15342)
+++ trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestDelay.java 2012-01-31 03:20:53 UTC (rev 15343)
@@ -205,7 +205,7 @@
public void test_Delay_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
int i = D.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, D.isSetMath() );
Modified: trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestEventAssignment_newSetters.java
===================================================================
--- trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestEventAssignment_newSetters.java 2012-01-31 03:20:14 UTC (rev 15342)
+++ trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestEventAssignment_newSetters.java 2012-01-31 03:20:53 UTC (rev 15343)
@@ -1,10 +1,9 @@
/*
* @file TestEventAssignment_newSetters.java
- * @brief EventAssignment unit tests for new set function API
+ * @brief EventAssignment unit tests for new set function API
*
* @author Akiya Jouraku (Java conversion)
- * @author Sarah Keating
-
+ * @author Sarah Keating
*
* ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
*
@@ -149,7 +148,7 @@
public void test_EventAssignment_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
int i = E.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, E.isSetMath() );
@@ -158,7 +157,7 @@
public void test_EventAssignment_setVariable1()
{
- String id = "1e1";
+ String id = "1e1";
int i = E.setVariable(id);
assertTrue( i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE );
assertEquals( false, E.isSetVariable() );
@@ -166,7 +165,7 @@
public void test_EventAssignment_setVariable2()
{
- String id = "e1";
+ String id = "e1";
int i = E.setVariable(id);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue(E.getVariable().equals(id));
@@ -229,4 +228,3 @@
}
}
}
-
Modified: trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestFunctionDefinition_newSetters.java
===================================================================
--- trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestFunctionDefinition_newSetters.java 2012-01-31 03:20:14 UTC (rev 15342)
+++ trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestFunctionDefinition_newSetters.java 2012-01-31 03:20:53 UTC (rev 15343)
@@ -1,10 +1,9 @@
/*
* @file TestFunctionDefinition_newSetters.java
- * @brief FunctionDefinition unit tests for new set function API
+ * @brief FunctionDefinition unit tests for new set function API
*
* @author Akiya Jouraku (Java conversion)
- * @author Sarah Keating
-
+ * @author Sarah Keating
*
* ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
*
@@ -135,7 +134,7 @@
public void test_FunctionDefinition_setId1()
{
- String id = "1e1";
+ String id = "1e1";
int i = E.setId(id);
assertTrue( i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE );
assertEquals( false, E.isSetId() );
@@ -143,7 +142,7 @@
public void test_FunctionDefinition_setId2()
{
- String id = "e1";
+ String id = "e1";
int i = E.setId(id);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue(E.getId().equals(id));
@@ -169,7 +168,7 @@
public void test_FunctionDefinition_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
int i = E.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, E.isSetMath() );
@@ -178,7 +177,7 @@
public void test_FunctionDefinition_setName1()
{
- String name = "3Set_k2";
+ String name = "3Set_k2";
int i = E.setName(name);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertEquals( true, E.isSetName() );
@@ -186,7 +185,7 @@
public void test_FunctionDefinition_setName2()
{
- String name = "Set k2";
+ String name = "Set k2";
int i = E.setName(name);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue(E.getName().equals(name));
Modified: trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestInitialAssignment_newSetters.java
===================================================================
--- trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestInitialAssignment_newSetters.java 2012-01-31 03:20:14 UTC (rev 15342)
+++ trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestInitialAssignment_newSetters.java 2012-01-31 03:20:53 UTC (rev 15343)
@@ -1,10 +1,9 @@
/*
* @file TestInitialAssignment_newSetters.java
- * @brief InitialAssignment unit tests for new set function API
+ * @brief InitialAssignment unit tests for new set function API
*
* @author Akiya Jouraku (Java conversion)
- * @author Sarah Keating
-
+ * @author Sarah Keating
*
* ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
*
@@ -149,7 +148,7 @@
public void test_InitialAssignment_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
int i = E.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, E.isSetMath() );
@@ -158,7 +157,7 @@
public void test_InitialAssignment_setSymbol1()
{
- String id = "1e1";
+ String id = "1e1";
int i = E.setSymbol(id);
assertTrue( i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE );
assertEquals( false, E.isSetSymbol() );
@@ -166,7 +165,7 @@
public void test_InitialAssignment_setSymbol2()
{
- String id = "e1";
+ String id = "e1";
int i = E.setSymbol(id);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue(E.getSymbol().equals(id));
@@ -229,4 +228,3 @@
}
}
}
-
Modified: trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestKineticLaw_newSetters.java
===================================================================
--- trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestKineticLaw_newSetters.java 2012-01-31 03:20:14 UTC (rev 15342)
+++ trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestKineticLaw_newSetters.java 2012-01-31 03:20:53 UTC (rev 15343)
@@ -1,10 +1,9 @@
/*
* @file TestKineticLaw_newSetters.java
- * @brief KineticLaw unit tests for new set function API
+ * @brief KineticLaw unit tests for new set function API
*
* @author Akiya Jouraku (Java conversion)
- * @author Sarah Keating
-
+ * @author Sarah Keating
*
* ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
*
@@ -193,7 +192,7 @@
public void test_KineticLaw_setFormula1()
{
- String formula = "k1*X0";
+ String formula = "k1*X0";
int i = kl.setFormula(formula);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue(kl.getFormula().equals(formula));
@@ -209,7 +208,7 @@
public void test_KineticLaw_setFormula3()
{
- String formula = "k1 X0";
+ String formula = "k1 X0";
int i = kl.setFormula(formula);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, kl.isSetFormula() );
@@ -239,7 +238,7 @@
public void test_KineticLaw_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
ASTNode a = new ASTNode();
a.setName( "a");
math.addChild(a);
@@ -395,4 +394,3 @@
}
}
}
-
Modified: trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestPriority.java
===================================================================
--- trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestPriority.java 2012-01-31 03:20:14 UTC (rev 15342)
+++ trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestPriority.java 2012-01-31 03:20:53 UTC (rev 15343)
@@ -1,267 +1,267 @@
-/*
- * @file TestPriority.java
- * @brief SBML Priority unit tests
- *
- * @author Akiya Jouraku (Java conversion)
- * @author Sarah Keating
+/*
+ * @file TestPriority.java
+ * @brief SBML Priority unit tests
+ *
+ * @author Akiya Jouraku (Java conversion)
+ * @author Sarah Keating
*
- * ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
- *
- * DO NOT EDIT THIS FILE.
- *
- * This file was generated automatically by converting the file located at
- * src/sbml/test/TestPriority.c
- * using the conversion program dev/utilities/translateTests/translateTests.pl.
- * Any changes made here will be lost the next time the file is regenerated.
- *
- * -----------------------------------------------------------------------------
- * This file is part of libSBML. Please visit http://sbml.org for more
- * information about SBML, and the latest version of libSBML.
- *
- * Copyright 2005-2010 California Institute of Technology.
- * Copyright 2002-2005 California Institute of Technology and
- * Japan Science and Technology Corporation.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation. A copy of the license agreement is provided
- * in the file named "LICENSE.txt" included with this software distribution
- * and also available online as http://sbml.org/software/libsbml/license.html
- * -----------------------------------------------------------------------------
- */
-
-package org.sbml.libsbml.test.sbml;
-
-import org.sbml.libsbml.*;
-
-import java.io.File;
-import java.lang.AssertionError;
-
-public class TestPriority {
-
- static void assertTrue(boolean condition) throws AssertionError
- {
- if (condition == true)
- {
- return;
- }
- throw new AssertionError();
- }
-
- static void assertEquals(Object a, Object b) throws AssertionError
- {
- if ( (a == null) && (b == null) )
- {
- return;
- }
- else if ( (a == null) || (b == null) )
- {
- throw new AssertionError();
- }
- else if (a.equals(b))
- {
- return;
- }
-
- throw new AssertionError();
- }
-
- static void assertNotEquals(Object a, Object b) throws AssertionError
- {
- if ( (a == null) && (b == null) )
- {
- throw new AssertionError();
- }
- else if ( (a == null) || (b == null) )
- {
- return;
- }
- else if (a.equals(b))
- {
- throw new AssertionError();
- }
- }
-
- static void assertEquals(boolean a, boolean b) throws AssertionError
- {
- if ( a == b )
- {
- return;
- }
- throw new AssertionError();
- }
-
- static void assertNotEquals(boolean a, boolean b) throws AssertionError
- {
- if ( a != b )
- {
- return;
- }
- throw new AssertionError();
- }
-
- static void assertEquals(int a, int b) throws AssertionError
- {
- if ( a == b )
- {
- return;
- }
- throw new AssertionError();
- }
-
- static void assertNotEquals(int a, int b) throws AssertionError
- {
- if ( a != b )
- {
- return;
- }
- throw new AssertionError();
- }
- private Priority P;
-
- protected void setUp() throws Exception
- {
- P = new Priority(3,1);
- if (P == null);
- {
- }
- }
-
- protected void tearDown() throws Exception
- {
- P = null;
- }
-
- public void test_Priority_create()
- {
- assertTrue( P.getTypeCode() == libsbml.SBML_PRIORITY );
- assertTrue( P.getMetaId().equals("") == true );
- assertTrue( P.getNotes() == null );
- assertTrue( P.getAnnotation() == null );
- assertTrue( P.getMath() == null );
- }
-
- public void test_Priority_createWithNS()
- {
- XMLNamespaces xmlns = new XMLNamespaces();
- xmlns.add( "http://www.sbml.org", "testsbml");
- SBMLNamespaces sbmlns = new SBMLNamespaces(3,1);
- sbmlns.addNamespaces(xmlns);
- Priority object = new Priority(sbmlns);
- assertTrue( object.getTypeCode() == libsbml.SBML_PRIORITY );
- assertTrue( object.getMetaId().equals("") == true );
- assertTrue( object.getNotes() == null );
- assertTrue( object.getAnnotation() == null );
- assertTrue( object.getLevel() == 3 );
- assertTrue( object.getVersion() == 1 );
- assertTrue( object.getNamespaces() != null );
- assertTrue( object.getNamespaces().getLength() == 2 );
- object = null;
- }
-
- public void test_Priority_free_NULL()
- {
- }
-
- public void test_Priority_setMath()
- {
- ASTNode math = libsbml.parseFormula("lambda(x, x^3)");
- ASTNode math1;
- String formula;
- P.setMath(math);
- math1 = P.getMath();
- assertTrue( math1 != null );
- formula = libsbml.formulaToString(math1);
- assertTrue( formula != null );
- assertTrue(formula.equals( "lambda(x, x^3)"));
- assertTrue( !P.getMath().equals(math) );
- assertEquals( true, P.isSetMath() );
- P.setMath(P.getMath());
- math1 = P.getMath();
- assertTrue( math1 != null );
- formula = libsbml.formulaToString(math1);
- assertTrue( formula != null );
- assertTrue(formula.equals( "lambda(x, x^3)"));
- P.setMath(null);
- assertEquals( false, P.isSetMath() );
- if (P.getMath() != null);
- {
- }
- }
-
- public void test_Priority_setMath1()
- {
- ASTNode math = libsbml.parseFormula("2 * k");
- int i = P.setMath(math);
- assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
- assertTrue( !P.getMath().equals(math) );
- assertEquals( true, P.isSetMath() );
- i = P.setMath(null);
- assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
- assertTrue( P.getMath() == null );
- assertEquals( false, P.isSetMath() );
- math = null;
- }
-
- public void test_Priority_setMath2()
- {
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
- int i = P.setMath(math);
- assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
- assertEquals( false, P.isSetMath() );
- math = null;
- }
-
- /**
- * Loads the SWIG-generated libSBML Java module when this class is
- * loaded, or reports a sensible diagnostic message about why it failed.
- */
- static
- {
- String varname;
- String shlibname;
-
- if (System.getProperty("mrj.version") != null)
- {
- varname = "DYLD_LIBRARY_PATH"; // We're on a Mac.
- shlibname = "libsbmlj.jnilib and/or libsbml.dylib";
- }
- else
- {
- varname = "LD_LIBRARY_PATH"; // We're not on a Mac.
- shlibname = "libsbmlj.so and/or libsbml.so";
- }
-
- try
- {
- System.loadLibrary("sbmlj");
- // For extra safety, check that the jar file is in the classpath.
- Class.forName("org.sbml.libsbml.libsbml");
- }
- catch (SecurityException e)
- {
- e.printStackTrace();
- System.err.println("Could not load the libSBML library files due to a"+
- " security exception.\n");
- System.exit(1);
- }
- catch (UnsatisfiedLinkError e)
- {
- e.printStackTrace();
- System.err.println("Error: could not link with the libSBML library files."+
- " It is likely\nyour " + varname +
- " environment variable does not include the directories\n"+
- "containing the " + shlibname + " library files.\n");
- System.exit(1);
- }
- catch (ClassNotFoundException e)
- {
- e.printStackTrace();
- System.err.println("Error: unable to load the file libsbmlj.jar."+
- " It is likely\nyour -classpath option and CLASSPATH" +
- " environment variable\n"+
- "do not include the path to libsbmlj.jar.\n");
- System.exit(1);
- }
- }
-}
+ * ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
+ *
+ * DO NOT EDIT THIS FILE.
+ *
+ * This file was generated automatically by converting the file located at
+ * src/sbml/test/TestPriority.c
+ * using the conversion program dev/utilities/translateTests/translateTests.pl.
+ * Any changes made here will be lost the next time the file is regenerated.
+ *
+ * -----------------------------------------------------------------------------
+ * This file is part of libSBML. Please visit http://sbml.org for more
+ * information about SBML, and the latest version of libSBML.
+ *
+ * Copyright 2005-2010 California Institute of Technology.
+ * Copyright 2002-2005 California Institute of Technology and
+ * Japan Science and Technology Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation. A copy of the license agreement is provided
+ * in the file named "LICENSE.txt" included with this software distribution
+ * and also available online as http://sbml.org/software/libsbml/license.html
+ * -----------------------------------------------------------------------------
+ */
+
+package org.sbml.libsbml.test.sbml;
+
+import org.sbml.libsbml.*;
+
+import java.io.File;
+import java.lang.AssertionError;
+
+public class TestPriority {
+
+ static void assertTrue(boolean condition) throws AssertionError
+ {
+ if (condition == true)
+ {
+ return;
+ }
+ throw new AssertionError();
+ }
+
+ static void assertEquals(Object a, Object b) throws AssertionError
+ {
+ if ( (a == null) && (b == null) )
+ {
+ return;
+ }
+ else if ( (a == null) || (b == null) )
+ {
+ throw new AssertionError();
+ }
+ else if (a.equals(b))
+ {
+ return;
+ }
+
+ throw new AssertionError();
+ }
+
+ static void assertNotEquals(Object a, Object b) throws AssertionError
+ {
+ if ( (a == null) && (b == null) )
+ {
+ throw new AssertionError();
+ }
+ else if ( (a == null) || (b == null) )
+ {
+ return;
+ }
+ else if (a.equals(b))
+ {
+ throw new AssertionError();
+ }
+ }
+
+ static void assertEquals(boolean a, boolean b) throws AssertionError
+ {
+ if ( a == b )
+ {
+ return;
+ }
+ throw new AssertionError();
+ }
+
+ static void assertNotEquals(boolean a, boolean b) throws AssertionError
+ {
+ if ( a != b )
+ {
+ return;
+ }
+ throw new AssertionError();
+ }
+
+ static void assertEquals(int a, int b) throws AssertionError
+ {
+ if ( a == b )
+ {
+ return;
+ }
+ throw new AssertionError();
+ }
+
+ static void assertNotEquals(int a, int b) throws AssertionError
+ {
+ if ( a != b )
+ {
+ return;
+ }
+ throw new AssertionError();
+ }
+ private Priority P;
+
+ protected void setUp() throws Exception
+ {
+ P = new Priority(3,1);
+ if (P == null);
+ {
+ }
+ }
+
+ protected void tearDown() throws Exception
+ {
+ P = null;
+ }
+
+ public void test_Priority_create()
+ {
+ assertTrue( P.getTypeCode() == libsbml.SBML_PRIORITY );
+ assertTrue( P.getMetaId().equals("") == true );
+ assertTrue( P.getNotes() == null );
+ assertTrue( P.getAnnotation() == null );
+ assertTrue( P.getMath() == null );
+ }
+
+ public void test_Priority_createWithNS()
+ {
+ XMLNamespaces xmlns = new XMLNamespaces();
+ xmlns.add( "http://www.sbml.org", "testsbml");
+ SBMLNamespaces sbmlns = new SBMLNamespaces(3,1);
+ sbmlns.addNamespaces(xmlns);
+ Priority object = new Priority(sbmlns);
+ assertTrue( object.getTypeCode() == libsbml.SBML_PRIORITY );
+ assertTrue( object.getMetaId().equals("") == true );
+ assertTrue( object.getNotes() == null );
+ assertTrue( object.getAnnotation() == null );
+ assertTrue( object.getLevel() == 3 );
+ assertTrue( object.getVersion() == 1 );
+ assertTrue( object.getNamespaces() != null );
+ assertTrue( object.getNamespaces().getLength() == 2 );
+ object = null;
+ }
+
+ public void test_Priority_free_NULL()
+ {
+ }
+
+ public void test_Priority_setMath()
+ {
+ ASTNode math = libsbml.parseFormula("lambda(x, x^3)");
+ ASTNode math1;
+ String formula;
+ P.setMath(math);
+ math1 = P.getMath();
+ assertTrue( math1 != null );
+ formula = libsbml.formulaToString(math1);
+ assertTrue( formula != null );
+ assertTrue(formula.equals( "lambda(x, x^3)"));
+ assertTrue( !P.getMath().equals(math) );
+ assertEquals( true, P.isSetMath() );
+ P.setMath(P.getMath());
+ math1 = P.getMath();
+ assertTrue( math1 != null );
+ formula = libsbml.formulaToString(math1);
+ assertTrue( formula != null );
+ assertTrue(formula.equals( "lambda(x, x^3)"));
+ P.setMath(null);
+ assertEquals( false, P.isSetMath() );
+ if (P.getMath() != null);
+ {
+ }
+ }
+
+ public void test_Priority_setMath1()
+ {
+ ASTNode math = libsbml.parseFormula("2 * k");
+ int i = P.setMath(math);
+ assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
+ assertTrue( !P.getMath().equals(math) );
+ assertEquals( true, P.isSetMath() );
+ i = P.setMath(null);
+ assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
+ assertTrue( P.getMath() == null );
+ assertEquals( false, P.isSetMath() );
+ math = null;
+ }
+
+ public void test_Priority_setMath2()
+ {
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
+ int i = P.setMath(math);
+ assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
+ assertEquals( false, P.isSetMath() );
+ math = null;
+ }
+
+ /**
+ * Loads the SWIG-generated libSBML Java module when this class is
+ * loaded, or reports a sensible diagnostic message about why it failed.
+ */
+ static
+ {
+ String varname;
+ String shlibname;
+
+ if (System.getProperty("mrj.version") != null)
+ {
+ varname = "DYLD_LIBRARY_PATH"; // We're on a Mac.
+ shlibname = "libsbmlj.jnilib and/or libsbml.dylib";
+ }
+ else
+ {
+ varname = "LD_LIBRARY_PATH"; // We're not on a Mac.
+ shlibname = "libsbmlj.so and/or libsbml.so";
+ }
+
+ try
+ {
+ System.loadLibrary("sbmlj");
+ // For extra safety, check that the jar file is in the classpath.
+ Class.forName("org.sbml.libsbml.libsbml");
+ }
+ catch (SecurityException e)
+ {
+ e.printStackTrace();
+ System.err.println("Could not load the libSBML library files due to a"+
+ " security exception.\n");
+ System.exit(1);
+ }
+ catch (UnsatisfiedLinkError e)
+ {
+ e.printStackTrace();
+ System.err.println("Error: could not link with the libSBML library files."+
+ " It is likely\nyour " + varname +
+ " environment variable does not include the directories\n"+
+ "containing the " + shlibname + " library files.\n");
+ System.exit(1);
+ }
+ catch (ClassNotFoundException e)
+ {
+ e.printStackTrace();
+ System.err.println("Error: unable to load the file libsbmlj.jar."+
+ " It is likely\nyour -classpath option and CLASSPATH" +
+ " environment variable\n"+
+ "do not include the path to libsbmlj.jar.\n");
+ System.exit(1);
+ }
+ }
+}
Modified: trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestRule_newSetters.java
===================================================================
--- trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestRule_newSetters.java 2012-01-31 03:20:14 UTC (rev 15342)
+++ trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestRule_newSetters.java 2012-01-31 03:20:53 UTC (rev 15343)
@@ -1,10 +1,9 @@
/*
* @file TestRule_newSetters.java
- * @brief Rule unit tests for new set function API
+ * @brief Rule unit tests for new set function API
*
* @author Akiya Jouraku (Java conversion)
- * @author Sarah Keating
-
+ * @author Sarah Keating
*
* ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
*
@@ -135,7 +134,7 @@
public void test_Rule_setFormula1()
{
- String formula = "k1*X0";
+ String formula = "k1*X0";
int i = R.setFormula(formula);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue(R.getFormula().equals(formula));
@@ -151,7 +150,7 @@
public void test_Rule_setFormula3()
{
- String formula = "k1 X0";
+ String formula = "k1 X0";
int i = R.setFormula(formula);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, R.isSetFormula() );
@@ -181,7 +180,7 @@
public void test_Rule_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
ASTNode a = new ASTNode();
a.setName( "a");
math.addChild(a);
@@ -323,4 +322,3 @@
}
}
}
-
Modified: trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestStoichiometryMath.java
===================================================================
--- trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestStoichiometryMath.java 2012-01-31 03:20:14 UTC (rev 15342)
+++ trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestStoichiometryMath.java 2012-01-31 03:20:53 UTC (rev 15343)
@@ -205,7 +205,7 @@
public void test_StoichiometryMath_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
int i = D.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, D.isSetMath() );
Modified: trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestTrigger.java
===================================================================
--- trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestTrigger.java 2012-01-31 03:20:14 UTC (rev 15342)
+++ trunk/libsbml/src/bindings/java/test/org/sbml/libsbml/test/sbml/TestTrigger.java 2012-01-31 03:20:53 UTC (rev 15343)
@@ -205,7 +205,7 @@
public void test_Trigger_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
int i = D.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, D.isSetMath() );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fbe...@us...> - 2012-01-31 03:20:21
|
Revision: 15342
http://sbml.svn.sourceforge.net/sbml/?rev=15342&view=rev
Author: fbergmann
Date: 2012-01-31 03:20:14 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
- converted changed csharp tests
Modified Paths:
--------------
trunk/libsbml/src/bindings/csharp/test/math/TestValidASTNode.cs
trunk/libsbml/src/bindings/csharp/test/sbml/TestConstraint_newSetters.cs
trunk/libsbml/src/bindings/csharp/test/sbml/TestDelay.cs
trunk/libsbml/src/bindings/csharp/test/sbml/TestEventAssignment_newSetters.cs
trunk/libsbml/src/bindings/csharp/test/sbml/TestFunctionDefinition_newSetters.cs
trunk/libsbml/src/bindings/csharp/test/sbml/TestInitialAssignment_newSetters.cs
trunk/libsbml/src/bindings/csharp/test/sbml/TestKineticLaw_newSetters.cs
trunk/libsbml/src/bindings/csharp/test/sbml/TestPriority.cs
trunk/libsbml/src/bindings/csharp/test/sbml/TestRule_newSetters.cs
trunk/libsbml/src/bindings/csharp/test/sbml/TestStoichiometryMath.cs
trunk/libsbml/src/bindings/csharp/test/sbml/TestTrigger.cs
Modified: trunk/libsbml/src/bindings/csharp/test/math/TestValidASTNode.cs
===================================================================
--- trunk/libsbml/src/bindings/csharp/test/math/TestValidASTNode.cs 2012-01-31 03:19:32 UTC (rev 15341)
+++ trunk/libsbml/src/bindings/csharp/test/math/TestValidASTNode.cs 2012-01-31 03:20:14 UTC (rev 15342)
@@ -2,8 +2,7 @@
/// @brief Test the isWellFormedASTNode function
/// @author Frank Bergmann (Csharp conversion)
/// @author Akiya Jouraku (Csharp conversion)
-/// @author Sarah Keating
-
+/// @author Sarah Keating
///
/// ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
///
@@ -161,6 +160,68 @@
n = null;
}
+ public void test_ValidASTNode_infix_nary_plus0()
+ {
+ ASTNode n = libsbml.readMathMLFromString("<math xmlns='http://www.w3.org/1998/Math/MathML'>" +
+ " <apply>" +
+ " <plus/>" +
+ " </apply>" +
+ "</math>");
+ assertTrue( n != null );
+ string formula = libsbml.formulaToString(n);
+ ASTNode node = libsbml.parseFormula(formula);
+ assertTrue( node != null );
+ n = null;
+ node = null;
+ }
+
+ public void test_ValidASTNode_infix_nary_plus1()
+ {
+ ASTNode n = libsbml.readMathMLFromString("<math xmlns='http://www.w3.org/1998/Math/MathML'>" +
+ " <apply>" +
+ " <plus/>" +
+ " <cn> 0 </cn>" +
+ " </apply>" +
+ "</math>");
+ assertTrue( n != null );
+ string formula = libsbml.formulaToString(n);
+ ASTNode node = libsbml.parseFormula(formula);
+ assertTrue( node != null );
+ n = null;
+ node = null;
+ }
+
+ public void test_ValidASTNode_infix_nary_times0()
+ {
+ ASTNode n = libsbml.readMathMLFromString("<math xmlns='http://www.w3.org/1998/Math/MathML'>" +
+ " <apply>" +
+ " <times/>" +
+ " </apply>" +
+ "</math>");
+ assertTrue( n != null );
+ string formula = libsbml.formulaToString(n);
+ ASTNode node = libsbml.parseFormula(formula);
+ assertTrue( node != null );
+ n = null;
+ node = null;
+ }
+
+ public void test_ValidASTNode_infix_nary_times1()
+ {
+ ASTNode n = libsbml.readMathMLFromString("<math xmlns='http://www.w3.org/1998/Math/MathML'>" +
+ " <apply>" +
+ " <times/>" +
+ " <cn> 0 </cn>" +
+ " </apply>" +
+ "</math>");
+ assertTrue( n != null );
+ string formula = libsbml.formulaToString(n);
+ ASTNode node = libsbml.parseFormula(formula);
+ assertTrue( node != null );
+ n = null;
+ node = null;
+ }
+
public void test_ValidASTNode_lambda()
{
ASTNode n = new ASTNode(libsbml.AST_LAMBDA);
@@ -179,11 +240,19 @@
public void test_ValidASTNode_nary()
{
- ASTNode n = new ASTNode(libsbml.AST_TIMES);
+ ASTNode n = new ASTNode(libsbml.AST_DIVIDE);
assertEquals( false, (n.isWellFormedASTNode()) );
ASTNode c = libsbml.parseFormula("c");
+ n.addChild(c.deepCopy());
+ assertEquals( false, (n.isWellFormedASTNode()) );
+ n.addChild(c.deepCopy());
+ assertEquals( true, (n.isWellFormedASTNode()) );
+ n.addChild(c.deepCopy());
+ assertEquals( false, (n.isWellFormedASTNode()) );
+ n = new ASTNode(libsbml.AST_TIMES);
+ assertEquals( true, (n.isWellFormedASTNode()) );
n.addChild(c);
- assertEquals( false, (n.isWellFormedASTNode()) );
+ assertEquals( true, (n.isWellFormedASTNode()) );
ASTNode d = libsbml.parseFormula("d");
n.addChild(d);
assertEquals( true, n.isWellFormedASTNode() );
@@ -193,6 +262,36 @@
n = null;
}
+ public void test_ValidASTNode_returnsBoolean()
+ {
+ ASTNode node = new ASTNode ( libsbml.AST_LOGICAL_AND );
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_LOGICAL_NOT);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_LOGICAL_OR);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_LOGICAL_XOR);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_FUNCTION_PIECEWISE);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_RELATIONAL_EQ);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_RELATIONAL_GEQ);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_RELATIONAL_GT);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_RELATIONAL_LEQ);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_RELATIONAL_LT);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_RELATIONAL_NEQ);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_CONSTANT_TRUE);
+ assertEquals( true, node.returnsBoolean() );
+ node.setType(libsbml.AST_CONSTANT_FALSE);
+ assertEquals( true, node.returnsBoolean() );
+ }
+
public void test_ValidASTNode_root()
{
ASTNode n = new ASTNode(libsbml.AST_FUNCTION_ROOT);
@@ -218,8 +317,7 @@
i = n.setType(libsbml.AST_PLUS);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( n.getType() == libsbml.AST_PLUS );
- string s = "" + n.getCharacter();
- assertTrue(( "+" == s ));
+ assertTrue( n.getCharacter() == '+' );
i = n.setType(libsbml.AST_FUNCTION_ARCCOSH);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( n.getType() == libsbml.AST_FUNCTION_ARCCOSH );
@@ -244,4 +342,3 @@
}
}
-
Modified: trunk/libsbml/src/bindings/csharp/test/sbml/TestConstraint_newSetters.cs
===================================================================
--- trunk/libsbml/src/bindings/csharp/test/sbml/TestConstraint_newSetters.cs 2012-01-31 03:19:32 UTC (rev 15341)
+++ trunk/libsbml/src/bindings/csharp/test/sbml/TestConstraint_newSetters.cs 2012-01-31 03:20:14 UTC (rev 15342)
@@ -1,11 +1,9 @@
/// @file TestConstraint_newSetters.cs
-/// @brief Constraint unit tests for new set function API
+/// @brief Constraint unit tests for new set function API
/// @author Frank Bergmann (Csharp conversion)
/// @author Akiya Jouraku (Csharp conversion)
-/// @author Sarah Keating
-
-///
-///
+/// @author Sarah Keating
+///
/// ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
///
/// DO NOT EDIT THIS FILE.
@@ -159,7 +157,7 @@
public void test_Constraint_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
int i = C.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, C.isSetMath() );
@@ -208,4 +206,3 @@
}
}
-
Modified: trunk/libsbml/src/bindings/csharp/test/sbml/TestDelay.cs
===================================================================
--- trunk/libsbml/src/bindings/csharp/test/sbml/TestDelay.cs 2012-01-31 03:19:32 UTC (rev 15341)
+++ trunk/libsbml/src/bindings/csharp/test/sbml/TestDelay.cs 2012-01-31 03:20:14 UTC (rev 15342)
@@ -3,8 +3,7 @@
/// @author Frank Bergmann (Csharp conversion)
/// @author Akiya Jouraku (Csharp conversion)
/// @author Sarah Keating
-///
-///
+///
/// ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
///
/// DO NOT EDIT THIS FILE.
@@ -215,7 +214,7 @@
public void test_Delay_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
int i = D.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, D.isSetMath() );
Modified: trunk/libsbml/src/bindings/csharp/test/sbml/TestEventAssignment_newSetters.cs
===================================================================
--- trunk/libsbml/src/bindings/csharp/test/sbml/TestEventAssignment_newSetters.cs 2012-01-31 03:19:32 UTC (rev 15341)
+++ trunk/libsbml/src/bindings/csharp/test/sbml/TestEventAssignment_newSetters.cs 2012-01-31 03:20:14 UTC (rev 15342)
@@ -1,11 +1,9 @@
/// @file TestEventAssignment_newSetters.cs
-/// @brief EventAssignment unit tests for new set function API
+/// @brief EventAssignment unit tests for new set function API
/// @author Frank Bergmann (Csharp conversion)
/// @author Akiya Jouraku (Csharp conversion)
-/// @author Sarah Keating
-
-///
-///
+/// @author Sarah Keating
+///
/// ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
///
/// DO NOT EDIT THIS FILE.
@@ -159,7 +157,7 @@
public void test_EventAssignment_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
int i = E.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, E.isSetMath() );
@@ -168,7 +166,7 @@
public void test_EventAssignment_setVariable1()
{
- string id = "1e1";
+ string id = "1e1";
int i = E.setVariable(id);
assertTrue( i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE );
assertEquals( false, E.isSetVariable() );
@@ -176,7 +174,7 @@
public void test_EventAssignment_setVariable2()
{
- string id = "e1";
+ string id = "e1";
int i = E.setVariable(id);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue(( id == E.getVariable() ));
@@ -188,4 +186,3 @@
}
}
-
Modified: trunk/libsbml/src/bindings/csharp/test/sbml/TestFunctionDefinition_newSetters.cs
===================================================================
--- trunk/libsbml/src/bindings/csharp/test/sbml/TestFunctionDefinition_newSetters.cs 2012-01-31 03:19:32 UTC (rev 15341)
+++ trunk/libsbml/src/bindings/csharp/test/sbml/TestFunctionDefinition_newSetters.cs 2012-01-31 03:20:14 UTC (rev 15342)
@@ -1,11 +1,9 @@
/// @file TestFunctionDefinition_newSetters.cs
-/// @brief FunctionDefinition unit tests for new set function API
+/// @brief FunctionDefinition unit tests for new set function API
/// @author Frank Bergmann (Csharp conversion)
/// @author Akiya Jouraku (Csharp conversion)
-/// @author Sarah Keating
-
-///
-///
+/// @author Sarah Keating
+///
/// ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
///
/// DO NOT EDIT THIS FILE.
@@ -145,7 +143,7 @@
public void test_FunctionDefinition_setId1()
{
- string id = "1e1";
+ string id = "1e1";
int i = E.setId(id);
assertTrue( i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE );
assertEquals( false, E.isSetId() );
@@ -153,7 +151,7 @@
public void test_FunctionDefinition_setId2()
{
- string id = "e1";
+ string id = "e1";
int i = E.setId(id);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue(( id == E.getId() ));
@@ -179,7 +177,7 @@
public void test_FunctionDefinition_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
int i = E.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, E.isSetMath() );
@@ -188,7 +186,7 @@
public void test_FunctionDefinition_setName1()
{
- string name = "3Set_k2";
+ string name = "3Set_k2";
int i = E.setName(name);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertEquals( true, E.isSetName() );
@@ -196,7 +194,7 @@
public void test_FunctionDefinition_setName2()
{
- string name = "Set k2";
+ string name = "Set k2";
int i = E.setName(name);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue(( name == E.getName() ));
Modified: trunk/libsbml/src/bindings/csharp/test/sbml/TestInitialAssignment_newSetters.cs
===================================================================
--- trunk/libsbml/src/bindings/csharp/test/sbml/TestInitialAssignment_newSetters.cs 2012-01-31 03:19:32 UTC (rev 15341)
+++ trunk/libsbml/src/bindings/csharp/test/sbml/TestInitialAssignment_newSetters.cs 2012-01-31 03:20:14 UTC (rev 15342)
@@ -1,11 +1,9 @@
/// @file TestInitialAssignment_newSetters.cs
-/// @brief InitialAssignment unit tests for new set function API
+/// @brief InitialAssignment unit tests for new set function API
/// @author Frank Bergmann (Csharp conversion)
/// @author Akiya Jouraku (Csharp conversion)
-/// @author Sarah Keating
-
-///
-///
+/// @author Sarah Keating
+///
/// ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
///
/// DO NOT EDIT THIS FILE.
@@ -159,7 +157,7 @@
public void test_InitialAssignment_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
int i = E.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, E.isSetMath() );
@@ -168,7 +166,7 @@
public void test_InitialAssignment_setSymbol1()
{
- string id = "1e1";
+ string id = "1e1";
int i = E.setSymbol(id);
assertTrue( i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE );
assertEquals( false, E.isSetSymbol() );
@@ -176,7 +174,7 @@
public void test_InitialAssignment_setSymbol2()
{
- string id = "e1";
+ string id = "e1";
int i = E.setSymbol(id);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue(( id == E.getSymbol() ));
@@ -188,4 +186,3 @@
}
}
-
Modified: trunk/libsbml/src/bindings/csharp/test/sbml/TestKineticLaw_newSetters.cs
===================================================================
--- trunk/libsbml/src/bindings/csharp/test/sbml/TestKineticLaw_newSetters.cs 2012-01-31 03:19:32 UTC (rev 15341)
+++ trunk/libsbml/src/bindings/csharp/test/sbml/TestKineticLaw_newSetters.cs 2012-01-31 03:20:14 UTC (rev 15342)
@@ -1,11 +1,9 @@
/// @file TestKineticLaw_newSetters.cs
-/// @brief KineticLaw unit tests for new set function API
+/// @brief KineticLaw unit tests for new set function API
/// @author Frank Bergmann (Csharp conversion)
/// @author Akiya Jouraku (Csharp conversion)
-/// @author Sarah Keating
-
-///
-///
+/// @author Sarah Keating
+///
/// ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
///
/// DO NOT EDIT THIS FILE.
@@ -203,7 +201,7 @@
public void test_KineticLaw_setFormula1()
{
- string formula = "k1*X0";
+ string formula = "k1*X0";
int i = kl.setFormula(formula);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue(( formula == kl.getFormula() ));
@@ -219,7 +217,7 @@
public void test_KineticLaw_setFormula3()
{
- string formula = "k1 X0";
+ string formula = "k1 X0";
int i = kl.setFormula(formula);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, kl.isSetFormula() );
@@ -249,7 +247,7 @@
public void test_KineticLaw_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
ASTNode a = new ASTNode();
a.setName( "a");
math.addChild(a);
@@ -354,4 +352,3 @@
}
}
-
Modified: trunk/libsbml/src/bindings/csharp/test/sbml/TestPriority.cs
===================================================================
--- trunk/libsbml/src/bindings/csharp/test/sbml/TestPriority.cs 2012-01-31 03:19:32 UTC (rev 15341)
+++ trunk/libsbml/src/bindings/csharp/test/sbml/TestPriority.cs 2012-01-31 03:20:14 UTC (rev 15342)
@@ -1,11 +1,9 @@
/// @file TestPriority.cs
-/// @brief SBML Priority unit tests
+/// @brief SBML Priority unit tests
/// @author Frank Bergmann (Csharp conversion)
/// @author Akiya Jouraku (Csharp conversion)
-/// @author Sarah Keating
-
-///
-///
+/// @author Sarah Keating
+///
/// ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
///
/// DO NOT EDIT THIS FILE.
@@ -216,7 +214,7 @@
public void test_Priority_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
int i = P.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, P.isSetMath() );
Modified: trunk/libsbml/src/bindings/csharp/test/sbml/TestRule_newSetters.cs
===================================================================
--- trunk/libsbml/src/bindings/csharp/test/sbml/TestRule_newSetters.cs 2012-01-31 03:19:32 UTC (rev 15341)
+++ trunk/libsbml/src/bindings/csharp/test/sbml/TestRule_newSetters.cs 2012-01-31 03:20:14 UTC (rev 15342)
@@ -1,11 +1,9 @@
/// @file TestRule_newSetters.cs
-/// @brief Rule unit tests for new set function API
+/// @brief Rule unit tests for new set function API
/// @author Frank Bergmann (Csharp conversion)
/// @author Akiya Jouraku (Csharp conversion)
-/// @author Sarah Keating
-
-///
-///
+/// @author Sarah Keating
+///
/// ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
///
/// DO NOT EDIT THIS FILE.
@@ -145,7 +143,7 @@
public void test_Rule_setFormula1()
{
- string formula = "k1*X0";
+ string formula = "k1*X0";
int i = R.setFormula(formula);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue(( formula == R.getFormula() ));
@@ -161,7 +159,7 @@
public void test_Rule_setFormula3()
{
- string formula = "k1 X0";
+ string formula = "k1 X0";
int i = R.setFormula(formula);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, R.isSetFormula() );
@@ -191,7 +189,7 @@
public void test_Rule_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
ASTNode a = new ASTNode();
a.setName( "a");
math.addChild(a);
@@ -282,4 +280,3 @@
}
}
-
Modified: trunk/libsbml/src/bindings/csharp/test/sbml/TestStoichiometryMath.cs
===================================================================
--- trunk/libsbml/src/bindings/csharp/test/sbml/TestStoichiometryMath.cs 2012-01-31 03:19:32 UTC (rev 15341)
+++ trunk/libsbml/src/bindings/csharp/test/sbml/TestStoichiometryMath.cs 2012-01-31 03:20:14 UTC (rev 15342)
@@ -3,8 +3,7 @@
/// @author Frank Bergmann (Csharp conversion)
/// @author Akiya Jouraku (Csharp conversion)
/// @author Sarah Keating
-///
-///
+///
/// ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
///
/// DO NOT EDIT THIS FILE.
@@ -215,7 +214,7 @@
public void test_StoichiometryMath_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
int i = D.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, D.isSetMath() );
Modified: trunk/libsbml/src/bindings/csharp/test/sbml/TestTrigger.cs
===================================================================
--- trunk/libsbml/src/bindings/csharp/test/sbml/TestTrigger.cs 2012-01-31 03:19:32 UTC (rev 15341)
+++ trunk/libsbml/src/bindings/csharp/test/sbml/TestTrigger.cs 2012-01-31 03:20:14 UTC (rev 15342)
@@ -3,8 +3,7 @@
/// @author Frank Bergmann (Csharp conversion)
/// @author Akiya Jouraku (Csharp conversion)
/// @author Sarah Keating
-///
-///
+///
/// ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
///
/// DO NOT EDIT THIS FILE.
@@ -215,7 +214,7 @@
public void test_Trigger_setMath2()
{
- ASTNode math = new ASTNode(libsbml.AST_TIMES);
+ ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
int i = D.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, D.isSetMath() );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fbe...@us...> - 2012-01-31 03:19:39
|
Revision: 15341
http://sbml.svn.sourceforge.net/sbml/?rev=15341&view=rev
Author: fbergmann
Date: 2012-01-31 03:19:32 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
- converted changed ruby tests
Modified Paths:
--------------
trunk/libsbml/src/bindings/ruby/test/math/TestValidASTNode.rb
trunk/libsbml/src/bindings/ruby/test/sbml/TestConstraint_newSetters.rb
trunk/libsbml/src/bindings/ruby/test/sbml/TestDelay.rb
trunk/libsbml/src/bindings/ruby/test/sbml/TestEventAssignment_newSetters.rb
trunk/libsbml/src/bindings/ruby/test/sbml/TestFunctionDefinition_newSetters.rb
trunk/libsbml/src/bindings/ruby/test/sbml/TestInitialAssignment_newSetters.rb
trunk/libsbml/src/bindings/ruby/test/sbml/TestKineticLaw_newSetters.rb
trunk/libsbml/src/bindings/ruby/test/sbml/TestPriority.rb
trunk/libsbml/src/bindings/ruby/test/sbml/TestRule_newSetters.rb
trunk/libsbml/src/bindings/ruby/test/sbml/TestStoichiometryMath.rb
trunk/libsbml/src/bindings/ruby/test/sbml/TestTrigger.rb
Modified: trunk/libsbml/src/bindings/ruby/test/math/TestValidASTNode.rb
===================================================================
--- trunk/libsbml/src/bindings/ruby/test/math/TestValidASTNode.rb 2012-01-31 03:18:58 UTC (rev 15340)
+++ trunk/libsbml/src/bindings/ruby/test/math/TestValidASTNode.rb 2012-01-31 03:19:32 UTC (rev 15341)
@@ -3,14 +3,13 @@
#
# @author Akiya Jouraku (Ruby conversion)
# @author Sarah Keating
-#
-#
+#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
# DO NOT EDIT THIS FILE.
#
# This file was generated automatically by converting the file located at
-# src/math/test/TestValidASTNode.cpp
+# src/sbml/test/TestValidASTNode.cpp
# using the conversion program dev/utilities/translateTests/translateTests.pl.
# Any changes made here will be lost the next time the file is regenerated.
#
@@ -63,6 +62,64 @@
n = nil
end
+ def test_ValidASTNode_infix_nary_plus0
+ n = LibSBML::readMathMLFromString("<math xmlns='http://www.w3.org/1998/Math/MathML'>" +
+ " <apply>" +
+ " <plus/>" +
+ " </apply>" +
+ "</math>")
+ assert( n != nil )
+ formula = LibSBML::formulaToString(n)
+ node = LibSBML::parseFormula(formula)
+ assert( node != nil )
+ n = nil
+ node = nil
+ end
+
+ def test_ValidASTNode_infix_nary_plus1
+ n = LibSBML::readMathMLFromString("<math xmlns='http://www.w3.org/1998/Math/MathML'>" +
+ " <apply>" +
+ " <plus/>" +
+ " <cn> 0 </cn>" +
+ " </apply>" +
+ "</math>")
+ assert( n != nil )
+ formula = LibSBML::formulaToString(n)
+ node = LibSBML::parseFormula(formula)
+ assert( node != nil )
+ n = nil
+ node = nil
+ end
+
+ def test_ValidASTNode_infix_nary_times0
+ n = LibSBML::readMathMLFromString("<math xmlns='http://www.w3.org/1998/Math/MathML'>" +
+ " <apply>" +
+ " <times/>" +
+ " </apply>" +
+ "</math>")
+ assert( n != nil )
+ formula = LibSBML::formulaToString(n)
+ node = LibSBML::parseFormula(formula)
+ assert( node != nil )
+ n = nil
+ node = nil
+ end
+
+ def test_ValidASTNode_infix_nary_times1
+ n = LibSBML::readMathMLFromString("<math xmlns='http://www.w3.org/1998/Math/MathML'>" +
+ " <apply>" +
+ " <times/>" +
+ " <cn> 0 </cn>" +
+ " </apply>" +
+ "</math>")
+ assert( n != nil )
+ formula = LibSBML::formulaToString(n)
+ node = LibSBML::parseFormula(formula)
+ assert( node != nil )
+ n = nil
+ node = nil
+ end
+
def test_ValidASTNode_lambda
n = LibSBML::ASTNode.new(LibSBML::AST_LAMBDA)
assert_equal false, (n.isWellFormedASTNode())
@@ -79,11 +136,19 @@
end
def test_ValidASTNode_nary
- n = LibSBML::ASTNode.new(LibSBML::AST_TIMES)
+ n = LibSBML::ASTNode.new(LibSBML::AST_DIVIDE)
assert_equal false, (n.isWellFormedASTNode())
c = LibSBML::parseFormula("c")
+ n.addChild(c.deepCopy())
+ assert_equal false, (n.isWellFormedASTNode())
+ n.addChild(c.deepCopy())
+ assert_equal true, (n.isWellFormedASTNode())
+ n.addChild(c.deepCopy())
+ assert_equal false, (n.isWellFormedASTNode())
+ n = LibSBML::ASTNode.new(LibSBML::AST_TIMES)
+ assert_equal true, (n.isWellFormedASTNode())
n.addChild(c)
- assert_equal false, (n.isWellFormedASTNode())
+ assert_equal true, (n.isWellFormedASTNode())
d = LibSBML::parseFormula("d")
n.addChild(d)
assert_equal true, n.isWellFormedASTNode()
@@ -93,6 +158,35 @@
n = nil
end
+ def test_ValidASTNode_returnsBoolean
+ node = LibSBML::ASTNode.new( LibSBML::AST_LOGICAL_AND )
+ assert_equal true, node.returnsBoolean()
+ node.setType(LibSBML::AST_LOGICAL_NOT)
+ assert_equal true, node.returnsBoolean()
+ node.setType(LibSBML::AST_LOGICAL_OR)
+ assert_equal true, node.returnsBoolean()
+ node.setType(LibSBML::AST_LOGICAL_XOR)
+ assert_equal true, node.returnsBoolean()
+ node.setType(LibSBML::AST_FUNCTION_PIECEWISE)
+ assert_equal true, node.returnsBoolean()
+ node.setType(LibSBML::AST_RELATIONAL_EQ)
+ assert_equal true, node.returnsBoolean()
+ node.setType(LibSBML::AST_RELATIONAL_GEQ)
+ assert_equal true, node.returnsBoolean()
+ node.setType(LibSBML::AST_RELATIONAL_GT)
+ assert_equal true, node.returnsBoolean()
+ node.setType(LibSBML::AST_RELATIONAL_LEQ)
+ assert_equal true, node.returnsBoolean()
+ node.setType(LibSBML::AST_RELATIONAL_LT)
+ assert_equal true, node.returnsBoolean()
+ node.setType(LibSBML::AST_RELATIONAL_NEQ)
+ assert_equal true, node.returnsBoolean()
+ node.setType(LibSBML::AST_CONSTANT_TRUE)
+ assert_equal true, node.returnsBoolean()
+ node.setType(LibSBML::AST_CONSTANT_FALSE)
+ assert_equal true, node.returnsBoolean()
+ end
+
def test_ValidASTNode_root
n = LibSBML::ASTNode.new(LibSBML::AST_FUNCTION_ROOT)
assert_equal false, (n.isWellFormedASTNode())
@@ -139,4 +233,3 @@
end
end
-
Modified: trunk/libsbml/src/bindings/ruby/test/sbml/TestConstraint_newSetters.rb
===================================================================
--- trunk/libsbml/src/bindings/ruby/test/sbml/TestConstraint_newSetters.rb 2012-01-31 03:18:58 UTC (rev 15340)
+++ trunk/libsbml/src/bindings/ruby/test/sbml/TestConstraint_newSetters.rb 2012-01-31 03:19:32 UTC (rev 15341)
@@ -3,8 +3,7 @@
#
# @author Akiya Jouraku (Ruby conversion)
# @author Sarah Keating
-#
-#
+#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
# DO NOT EDIT THIS FILE.
@@ -57,7 +56,7 @@
end
def test_Constraint_setMath2
- math = LibSBML::ASTNode.new(LibSBML::AST_TIMES)
+ math = LibSBML::ASTNode.new(LibSBML::AST_DIVIDE)
i = @@c.setMath(math)
assert( i == LibSBML::LIBSBML_INVALID_OBJECT )
assert_equal false, @@c.isSetMath()
@@ -101,4 +100,3 @@
end
end
-
Modified: trunk/libsbml/src/bindings/ruby/test/sbml/TestDelay.rb
===================================================================
--- trunk/libsbml/src/bindings/ruby/test/sbml/TestDelay.rb 2012-01-31 03:18:58 UTC (rev 15340)
+++ trunk/libsbml/src/bindings/ruby/test/sbml/TestDelay.rb 2012-01-31 03:19:32 UTC (rev 15341)
@@ -1,118 +1,116 @@
-# @file TestDelay.rb
-# @brief SBML Delay unit tests
-#
-# @author Akiya Jouraku (Ruby conversion)
-# @author Sarah Keating
-#
-#
-# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
-#
-# DO NOT EDIT THIS FILE.
-#
-# This file was generated automatically by converting the file located at
-# src/sbml/test/TestDelay.c
-# using the conversion program dev/utilities/translateTests/translateTests.pl.
-# Any changes made here will be lost the next time the file is regenerated.
-#
-# -----------------------------------------------------------------------------
-# This file is part of libSBML. Please visit http://sbml.org for more
-# information about SBML, and the latest version of libSBML.
-#
-# Copyright 2005-2010 California Institute of Technology.
-# Copyright 2002-2005 California Institute of Technology and
-# Japan Science and Technology Corporation.
-#
-# This library is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation. A copy of the license agreement is provided
-# in the file named "LICENSE.txt" included with this software distribution
-# and also available online as http://sbml.org/software/libsbml/license.html
-# -----------------------------------------------------------------------------
-require 'test/unit'
-require 'libSBML'
-
-class TestDelay < Test::Unit::TestCase
-
- def setup
- @@d = LibSBML::Delay.new(2,4)
- if (@@d == nil)
- end
- end
-
- def teardown
- @@d = nil
- end
-
- def test_Delay_create
- assert( @@d.getTypeCode() == LibSBML::SBML_DELAY )
- assert( @@d.getMetaId() == "" )
- assert( @@d.getNotes() == nil )
- assert( @@d.getAnnotation() == nil )
- assert( @@d.getMath() == nil )
- end
-
- def test_Delay_createWithNS
- xmlns = LibSBML::XMLNamespaces.new()
- xmlns.add( "http://www.sbml.org", "testsbml")
- sbmlns = LibSBML::SBMLNamespaces.new(2,1)
- sbmlns.addNamespaces(xmlns)
- object = LibSBML::Delay.new(sbmlns)
- assert( object.getTypeCode() == LibSBML::SBML_DELAY )
- assert( object.getMetaId() == "" )
- assert( object.getNotes() == nil )
- assert( object.getAnnotation() == nil )
- assert( object.getLevel() == 2 )
- assert( object.getVersion() == 1 )
- assert( object.getNamespaces() != nil )
- assert( object.getNamespaces().getLength() == 2 )
- object = nil
- end
-
- def test_Delay_free_NULL
- end
-
- def test_Delay_setMath
- math = LibSBML::parseFormula("lambda(x, x^3)")
- @@d.setMath(math)
- math1 = @@d.getMath()
- assert( math1 != nil )
- formula = LibSBML::formulaToString(math1)
- assert( formula != nil )
- assert (( "lambda(x, x^3)" == formula ))
- assert( @@d.getMath() != math )
- assert_equal true, @@d.isSetMath()
- @@d.setMath(@@d.getMath())
- math1 = @@d.getMath()
- assert( math1 != nil )
- formula = LibSBML::formulaToString(math1)
- assert( formula != nil )
- assert (( "lambda(x, x^3)" == formula ))
- @@d.setMath(nil)
- assert_equal false, @@d.isSetMath()
- if (@@d.getMath() != nil)
- end
- end
-
- def test_Delay_setMath1
- math = LibSBML::parseFormula("2 * k")
- i = @@d.setMath(math)
- assert( i == LibSBML::LIBSBML_OPERATION_SUCCESS )
- assert( @@d.getMath() != math )
- assert_equal true, @@d.isSetMath()
- i = @@d.setMath(nil)
- assert( i == LibSBML::LIBSBML_OPERATION_SUCCESS )
- assert( @@d.getMath() == nil )
- assert_equal false, @@d.isSetMath()
- math = nil
- end
-
- def test_Delay_setMath2
- math = LibSBML::ASTNode.new(LibSBML::AST_TIMES)
- i = @@d.setMath(math)
- assert( i == LibSBML::LIBSBML_INVALID_OBJECT )
- assert_equal false, @@d.isSetMath()
- math = nil
- end
-
-end
+# @file TestDelay.rb
+# @brief SBML Delay unit tests
+#
+# @author Akiya Jouraku (Ruby conversion)
+# @author Sarah Keating
+#
+# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
+#
+# DO NOT EDIT THIS FILE.
+#
+# This file was generated automatically by converting the file located at
+# src/sbml/test/TestDelay.c
+# using the conversion program dev/utilities/translateTests/translateTests.pl.
+# Any changes made here will be lost the next time the file is regenerated.
+#
+# -----------------------------------------------------------------------------
+# This file is part of libSBML. Please visit http://sbml.org for more
+# information about SBML, and the latest version of libSBML.
+#
+# Copyright 2005-2010 California Institute of Technology.
+# Copyright 2002-2005 California Institute of Technology and
+# Japan Science and Technology Corporation.
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation. A copy of the license agreement is provided
+# in the file named "LICENSE.txt" included with this software distribution
+# and also available online as http://sbml.org/software/libsbml/license.html
+# -----------------------------------------------------------------------------
+require 'test/unit'
+require 'libSBML'
+class TestDelay < Test::Unit::TestCase
+
+ def setup
+ @@d = LibSBML::Delay.new(2,4)
+ if (@@d == nil)
+ end
+ end
+
+ def teardown
+ @@d = nil
+ end
+
+ def test_Delay_create
+ assert( @@d.getTypeCode() == LibSBML::SBML_DELAY )
+ assert( @@d.getMetaId() == "" )
+ assert( @@d.getNotes() == nil )
+ assert( @@d.getAnnotation() == nil )
+ assert( @@d.getMath() == nil )
+ end
+
+ def test_Delay_createWithNS
+ xmlns = LibSBML::XMLNamespaces.new()
+ xmlns.add( "http://www.sbml.org", "testsbml")
+ sbmlns = LibSBML::SBMLNamespaces.new(2,1)
+ sbmlns.addNamespaces(xmlns)
+ object = LibSBML::Delay.new(sbmlns)
+ assert( object.getTypeCode() == LibSBML::SBML_DELAY )
+ assert( object.getMetaId() == "" )
+ assert( object.getNotes() == nil )
+ assert( object.getAnnotation() == nil )
+ assert( object.getLevel() == 2 )
+ assert( object.getVersion() == 1 )
+ assert( object.getNamespaces() != nil )
+ assert( object.getNamespaces().getLength() == 2 )
+ object = nil
+ end
+
+ def test_Delay_free_NULL
+ end
+
+ def test_Delay_setMath
+ math = LibSBML::parseFormula("lambda(x, x^3)")
+ @@d.setMath(math)
+ math1 = @@d.getMath()
+ assert( math1 != nil )
+ formula = LibSBML::formulaToString(math1)
+ assert( formula != nil )
+ assert (( "lambda(x, x^3)" == formula ))
+ assert( @@d.getMath() != math )
+ assert_equal true, @@d.isSetMath()
+ @@d.setMath(@@d.getMath())
+ math1 = @@d.getMath()
+ assert( math1 != nil )
+ formula = LibSBML::formulaToString(math1)
+ assert( formula != nil )
+ assert (( "lambda(x, x^3)" == formula ))
+ @@d.setMath(nil)
+ assert_equal false, @@d.isSetMath()
+ if (@@d.getMath() != nil)
+ end
+ end
+
+ def test_Delay_setMath1
+ math = LibSBML::parseFormula("2 * k")
+ i = @@d.setMath(math)
+ assert( i == LibSBML::LIBSBML_OPERATION_SUCCESS )
+ assert( @@d.getMath() != math )
+ assert_equal true, @@d.isSetMath()
+ i = @@d.setMath(nil)
+ assert( i == LibSBML::LIBSBML_OPERATION_SUCCESS )
+ assert( @@d.getMath() == nil )
+ assert_equal false, @@d.isSetMath()
+ math = nil
+ end
+
+ def test_Delay_setMath2
+ math = LibSBML::ASTNode.new(LibSBML::AST_DIVIDE)
+ i = @@d.setMath(math)
+ assert( i == LibSBML::LIBSBML_INVALID_OBJECT )
+ assert_equal false, @@d.isSetMath()
+ math = nil
+ end
+
+end
Modified: trunk/libsbml/src/bindings/ruby/test/sbml/TestEventAssignment_newSetters.rb
===================================================================
--- trunk/libsbml/src/bindings/ruby/test/sbml/TestEventAssignment_newSetters.rb 2012-01-31 03:18:58 UTC (rev 15340)
+++ trunk/libsbml/src/bindings/ruby/test/sbml/TestEventAssignment_newSetters.rb 2012-01-31 03:19:32 UTC (rev 15341)
@@ -3,8 +3,7 @@
#
# @author Akiya Jouraku (Ruby conversion)
# @author Sarah Keating
-#
-#
+#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
# DO NOT EDIT THIS FILE.
@@ -57,7 +56,7 @@
end
def test_EventAssignment_setMath2
- math = LibSBML::ASTNode.new(LibSBML::AST_TIMES)
+ math = LibSBML::ASTNode.new(LibSBML::AST_DIVIDE)
i = @@e.setMath(math)
assert( i == LibSBML::LIBSBML_INVALID_OBJECT )
assert_equal false, @@e.isSetMath()
@@ -83,4 +82,3 @@
end
end
-
Modified: trunk/libsbml/src/bindings/ruby/test/sbml/TestFunctionDefinition_newSetters.rb
===================================================================
--- trunk/libsbml/src/bindings/ruby/test/sbml/TestFunctionDefinition_newSetters.rb 2012-01-31 03:18:58 UTC (rev 15340)
+++ trunk/libsbml/src/bindings/ruby/test/sbml/TestFunctionDefinition_newSetters.rb 2012-01-31 03:19:32 UTC (rev 15341)
@@ -3,8 +3,7 @@
#
# @author Akiya Jouraku (Ruby conversion)
# @author Sarah Keating
-#
-#
+#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
# DO NOT EDIT THIS FILE.
@@ -75,7 +74,7 @@
end
def test_FunctionDefinition_setMath2
- math = LibSBML::ASTNode.new(LibSBML::AST_TIMES)
+ math = LibSBML::ASTNode.new(LibSBML::AST_DIVIDE)
i = @@e.setMath(math)
assert( i == LibSBML::LIBSBML_INVALID_OBJECT )
assert_equal false, @@e.isSetMath()
@@ -107,4 +106,3 @@
end
end
-
Modified: trunk/libsbml/src/bindings/ruby/test/sbml/TestInitialAssignment_newSetters.rb
===================================================================
--- trunk/libsbml/src/bindings/ruby/test/sbml/TestInitialAssignment_newSetters.rb 2012-01-31 03:18:58 UTC (rev 15340)
+++ trunk/libsbml/src/bindings/ruby/test/sbml/TestInitialAssignment_newSetters.rb 2012-01-31 03:19:32 UTC (rev 15341)
@@ -3,8 +3,7 @@
#
# @author Akiya Jouraku (Ruby conversion)
# @author Sarah Keating
-#
-#
+#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
# DO NOT EDIT THIS FILE.
@@ -57,7 +56,7 @@
end
def test_InitialAssignment_setMath2
- math = LibSBML::ASTNode.new(LibSBML::AST_TIMES)
+ math = LibSBML::ASTNode.new(LibSBML::AST_DIVIDE)
i = @@e.setMath(math)
assert( i == LibSBML::LIBSBML_INVALID_OBJECT )
assert_equal false, @@e.isSetMath()
@@ -83,4 +82,3 @@
end
end
-
Modified: trunk/libsbml/src/bindings/ruby/test/sbml/TestKineticLaw_newSetters.rb
===================================================================
--- trunk/libsbml/src/bindings/ruby/test/sbml/TestKineticLaw_newSetters.rb 2012-01-31 03:18:58 UTC (rev 15340)
+++ trunk/libsbml/src/bindings/ruby/test/sbml/TestKineticLaw_newSetters.rb 2012-01-31 03:19:32 UTC (rev 15341)
@@ -3,8 +3,7 @@
#
# @author Akiya Jouraku (Ruby conversion)
# @author Sarah Keating
-#
-#
+#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
# DO NOT EDIT THIS FILE.
@@ -137,7 +136,7 @@
end
def test_KineticLaw_setMath2
- math = LibSBML::ASTNode.new(LibSBML::AST_TIMES)
+ math = LibSBML::ASTNode.new(LibSBML::AST_DIVIDE)
a = LibSBML::ASTNode.new()
a.setName( "a")
math.addChild(a)
Modified: trunk/libsbml/src/bindings/ruby/test/sbml/TestPriority.rb
===================================================================
--- trunk/libsbml/src/bindings/ruby/test/sbml/TestPriority.rb 2012-01-31 03:18:58 UTC (rev 15340)
+++ trunk/libsbml/src/bindings/ruby/test/sbml/TestPriority.rb 2012-01-31 03:19:32 UTC (rev 15341)
@@ -1,118 +1,116 @@
-# @file TestPriority.rb
-# @brief SBML Priority unit tests
-#
-# @author Akiya Jouraku (Ruby conversion)
-# @author Sarah Keating
-#
-#
-# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
-#
-# DO NOT EDIT THIS FILE.
-#
-# This file was generated automatically by converting the file located at
-# src/sbml/test/TestPriority.c
-# using the conversion program dev/utilities/translateTests/translateTests.pl.
-# Any changes made here will be lost the next time the file is regenerated.
-#
-# -----------------------------------------------------------------------------
-# This file is part of libSBML. Please visit http://sbml.org for more
-# information about SBML, and the latest version of libSBML.
-#
-# Copyright 2005-2010 California Institute of Technology.
-# Copyright 2002-2005 California Institute of Technology and
-# Japan Science and Technology Corporation.
-#
-# This library is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation. A copy of the license agreement is provided
-# in the file named "LICENSE.txt" included with this software distribution
-# and also available online as http://sbml.org/software/libsbml/license.html
-# -----------------------------------------------------------------------------
-require 'test/unit'
-require 'libSBML'
-
-class TestPriority < Test::Unit::TestCase
-
- def setup
- @@p = LibSBML::Priority.new(3,1)
- if (@@p == nil)
- end
- end
-
- def teardown
- @@p = nil
- end
-
- def test_Priority_create
- assert( @@p.getTypeCode() == LibSBML::SBML_PRIORITY )
- assert( @@p.getMetaId() == "" )
- assert( @@p.getNotes() == nil )
- assert( @@p.getAnnotation() == nil )
- assert( @@p.getMath() == nil )
- end
-
- def test_Priority_createWithNS
- xmlns = LibSBML::XMLNamespaces.new()
- xmlns.add( "http://www.sbml.org", "testsbml")
- sbmlns = LibSBML::SBMLNamespaces.new(3,1)
- sbmlns.addNamespaces(xmlns)
- object = LibSBML::Priority.new(sbmlns)
- assert( object.getTypeCode() == LibSBML::SBML_PRIORITY )
- assert( object.getMetaId() == "" )
- assert( object.getNotes() == nil )
- assert( object.getAnnotation() == nil )
- assert( object.getLevel() == 3 )
- assert( object.getVersion() == 1 )
- assert( object.getNamespaces() != nil )
- assert( object.getNamespaces().getLength() == 2 )
- object = nil
- end
-
- def test_Priority_free_NULL
- end
-
- def test_Priority_setMath
- math = LibSBML::parseFormula("lambda(x, x^3)")
- @@p.setMath(math)
- math1 = @@p.getMath()
- assert( math1 != nil )
- formula = LibSBML::formulaToString(math1)
- assert( formula != nil )
- assert (( "lambda(x, x^3)" == formula ))
- assert( @@p.getMath() != math )
- assert_equal true, @@p.isSetMath()
- @@p.setMath(@@p.getMath())
- math1 = @@p.getMath()
- assert( math1 != nil )
- formula = LibSBML::formulaToString(math1)
- assert( formula != nil )
- assert (( "lambda(x, x^3)" == formula ))
- @@p.setMath(nil)
- assert_equal false, @@p.isSetMath()
- if (@@p.getMath() != nil)
- end
- end
-
- def test_Priority_setMath1
- math = LibSBML::parseFormula("2 * k")
- i = @@p.setMath(math)
- assert( i == LibSBML::LIBSBML_OPERATION_SUCCESS )
- assert( @@p.getMath() != math )
- assert_equal true, @@p.isSetMath()
- i = @@p.setMath(nil)
- assert( i == LibSBML::LIBSBML_OPERATION_SUCCESS )
- assert( @@p.getMath() == nil )
- assert_equal false, @@p.isSetMath()
- math = nil
- end
-
- def test_Priority_setMath2
- math = LibSBML::ASTNode.new(LibSBML::AST_TIMES)
- i = @@p.setMath(math)
- assert( i == LibSBML::LIBSBML_INVALID_OBJECT )
- assert_equal false, @@p.isSetMath()
- math = nil
- end
-
-end
+# @file TestPriority.rb
+# @brief SBML Priority unit tests
+#
+# @author Akiya Jouraku (Ruby conversion)
+# @author Sarah Keating
+#
+# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
+#
+# DO NOT EDIT THIS FILE.
+#
+# This file was generated automatically by converting the file located at
+# src/sbml/test/TestPriority.c
+# using the conversion program dev/utilities/translateTests/translateTests.pl.
+# Any changes made here will be lost the next time the file is regenerated.
+#
+# -----------------------------------------------------------------------------
+# This file is part of libSBML. Please visit http://sbml.org for more
+# information about SBML, and the latest version of libSBML.
+#
+# Copyright 2005-2010 California Institute of Technology.
+# Copyright 2002-2005 California Institute of Technology and
+# Japan Science and Technology Corporation.
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation. A copy of the license agreement is provided
+# in the file named "LICENSE.txt" included with this software distribution
+# and also available online as http://sbml.org/software/libsbml/license.html
+# -----------------------------------------------------------------------------
+require 'test/unit'
+require 'libSBML'
+class TestPriority < Test::Unit::TestCase
+
+ def setup
+ @@p = LibSBML::Priority.new(3,1)
+ if (@@p == nil)
+ end
+ end
+
+ def teardown
+ @@p = nil
+ end
+
+ def test_Priority_create
+ assert( @@p.getTypeCode() == LibSBML::SBML_PRIORITY )
+ assert( @@p.getMetaId() == "" )
+ assert( @@p.getNotes() == nil )
+ assert( @@p.getAnnotation() == nil )
+ assert( @@p.getMath() == nil )
+ end
+
+ def test_Priority_createWithNS
+ xmlns = LibSBML::XMLNamespaces.new()
+ xmlns.add( "http://www.sbml.org", "testsbml")
+ sbmlns = LibSBML::SBMLNamespaces.new(3,1)
+ sbmlns.addNamespaces(xmlns)
+ object = LibSBML::Priority.new(sbmlns)
+ assert( object.getTypeCode() == LibSBML::SBML_PRIORITY )
+ assert( object.getMetaId() == "" )
+ assert( object.getNotes() == nil )
+ assert( object.getAnnotation() == nil )
+ assert( object.getLevel() == 3 )
+ assert( object.getVersion() == 1 )
+ assert( object.getNamespaces() != nil )
+ assert( object.getNamespaces().getLength() == 2 )
+ object = nil
+ end
+
+ def test_Priority_free_NULL
+ end
+
+ def test_Priority_setMath
+ math = LibSBML::parseFormula("lambda(x, x^3)")
+ @@p.setMath(math)
+ math1 = @@p.getMath()
+ assert( math1 != nil )
+ formula = LibSBML::formulaToString(math1)
+ assert( formula != nil )
+ assert (( "lambda(x, x^3)" == formula ))
+ assert( @@p.getMath() != math )
+ assert_equal true, @@p.isSetMath()
+ @@p.setMath(@@p.getMath())
+ math1 = @@p.getMath()
+ assert( math1 != nil )
+ formula = LibSBML::formulaToString(math1)
+ assert( formula != nil )
+ assert (( "lambda(x, x^3)" == formula ))
+ @@p.setMath(nil)
+ assert_equal false, @@p.isSetMath()
+ if (@@p.getMath() != nil)
+ end
+ end
+
+ def test_Priority_setMath1
+ math = LibSBML::parseFormula("2 * k")
+ i = @@p.setMath(math)
+ assert( i == LibSBML::LIBSBML_OPERATION_SUCCESS )
+ assert( @@p.getMath() != math )
+ assert_equal true, @@p.isSetMath()
+ i = @@p.setMath(nil)
+ assert( i == LibSBML::LIBSBML_OPERATION_SUCCESS )
+ assert( @@p.getMath() == nil )
+ assert_equal false, @@p.isSetMath()
+ math = nil
+ end
+
+ def test_Priority_setMath2
+ math = LibSBML::ASTNode.new(LibSBML::AST_DIVIDE)
+ i = @@p.setMath(math)
+ assert( i == LibSBML::LIBSBML_INVALID_OBJECT )
+ assert_equal false, @@p.isSetMath()
+ math = nil
+ end
+
+end
Modified: trunk/libsbml/src/bindings/ruby/test/sbml/TestRule_newSetters.rb
===================================================================
--- trunk/libsbml/src/bindings/ruby/test/sbml/TestRule_newSetters.rb 2012-01-31 03:18:58 UTC (rev 15340)
+++ trunk/libsbml/src/bindings/ruby/test/sbml/TestRule_newSetters.rb 2012-01-31 03:19:32 UTC (rev 15341)
@@ -3,8 +3,7 @@
#
# @author Akiya Jouraku (Ruby conversion)
# @author Sarah Keating
-#
-#
+#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
# DO NOT EDIT THIS FILE.
@@ -84,7 +83,7 @@
end
def test_Rule_setMath2
- math = LibSBML::ASTNode.new(LibSBML::AST_TIMES)
+ math = LibSBML::ASTNode.new(LibSBML::AST_DIVIDE)
a = LibSBML::ASTNode.new()
a.setName( "a")
math.addChild(a)
Modified: trunk/libsbml/src/bindings/ruby/test/sbml/TestStoichiometryMath.rb
===================================================================
--- trunk/libsbml/src/bindings/ruby/test/sbml/TestStoichiometryMath.rb 2012-01-31 03:18:58 UTC (rev 15340)
+++ trunk/libsbml/src/bindings/ruby/test/sbml/TestStoichiometryMath.rb 2012-01-31 03:19:32 UTC (rev 15341)
@@ -1,118 +1,116 @@
-# @file TestStoichiometryMath.rb
-# @brief SBML StoichiometryMath unit tests
-#
-# @author Akiya Jouraku (Ruby conversion)
-# @author Sarah Keating
-#
-#
-# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
-#
-# DO NOT EDIT THIS FILE.
-#
-# This file was generated automatically by converting the file located at
-# src/sbml/test/TestStoichiometryMath.c
-# using the conversion program dev/utilities/translateTests/translateTests.pl.
-# Any changes made here will be lost the next time the file is regenerated.
-#
-# -----------------------------------------------------------------------------
-# This file is part of libSBML. Please visit http://sbml.org for more
-# information about SBML, and the latest version of libSBML.
-#
-# Copyright 2005-2010 California Institute of Technology.
-# Copyright 2002-2005 California Institute of Technology and
-# Japan Science and Technology Corporation.
-#
-# This library is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation. A copy of the license agreement is provided
-# in the file named "LICENSE.txt" included with this software distribution
-# and also available online as http://sbml.org/software/libsbml/license.html
-# -----------------------------------------------------------------------------
-require 'test/unit'
-require 'libSBML'
-
-class TestStoichiometryMath < Test::Unit::TestCase
-
- def setup
- @@d = LibSBML::StoichiometryMath.new(2,4)
- if (@@d == nil)
- end
- end
-
- def teardown
- @@d = nil
- end
-
- def test_StoichiometryMath_create
- assert( @@d.getTypeCode() == LibSBML::SBML_STOICHIOMETRY_MATH )
- assert( @@d.getMetaId() == "" )
- assert( @@d.getNotes() == nil )
- assert( @@d.getAnnotation() == nil )
- assert( @@d.getMath() == nil )
- end
-
- def test_StoichiometryMath_createWithNS
- xmlns = LibSBML::XMLNamespaces.new()
- xmlns.add( "http://www.sbml.org", "testsbml")
- sbmlns = LibSBML::SBMLNamespaces.new(2,1)
- sbmlns.addNamespaces(xmlns)
- object = LibSBML::StoichiometryMath.new(sbmlns)
- assert( object.getTypeCode() == LibSBML::SBML_STOICHIOMETRY_MATH )
- assert( object.getMetaId() == "" )
- assert( object.getNotes() == nil )
- assert( object.getAnnotation() == nil )
- assert( object.getLevel() == 2 )
- assert( object.getVersion() == 1 )
- assert( object.getNamespaces() != nil )
- assert( object.getNamespaces().getLength() == 2 )
- object = nil
- end
-
- def test_StoichiometryMath_free_NULL
- end
-
- def test_StoichiometryMath_setMath
- math = LibSBML::parseFormula("lambda(x, x^3)")
- @@d.setMath(math)
- math1 = @@d.getMath()
- assert( math1 != nil )
- formula = LibSBML::formulaToString(math1)
- assert( formula != nil )
- assert (( "lambda(x, x^3)" == formula ))
- assert( @@d.getMath() != math )
- assert_equal true, @@d.isSetMath()
- @@d.setMath(@@d.getMath())
- math1 = @@d.getMath()
- assert( math1 != nil )
- formula = LibSBML::formulaToString(math1)
- assert( formula != nil )
- assert (( "lambda(x, x^3)" == formula ))
- @@d.setMath(nil)
- assert_equal false, @@d.isSetMath()
- if (@@d.getMath() != nil)
- end
- end
-
- def test_StoichiometryMath_setMath1
- math = LibSBML::parseFormula("2 * k")
- i = @@d.setMath(math)
- assert( i == LibSBML::LIBSBML_OPERATION_SUCCESS )
- assert( @@d.getMath() != math )
- assert_equal true, @@d.isSetMath()
- i = @@d.setMath(nil)
- assert( i == LibSBML::LIBSBML_OPERATION_SUCCESS )
- assert( @@d.getMath() == nil )
- assert_equal false, @@d.isSetMath()
- math = nil
- end
-
- def test_StoichiometryMath_setMath2
- math = LibSBML::ASTNode.new(LibSBML::AST_TIMES)
- i = @@d.setMath(math)
- assert( i == LibSBML::LIBSBML_INVALID_OBJECT )
- assert_equal false, @@d.isSetMath()
- math = nil
- end
-
-end
+# @file TestStoichiometryMath.rb
+# @brief SBML StoichiometryMath unit tests
+#
+# @author Akiya Jouraku (Ruby conversion)
+# @author Sarah Keating
+#
+# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
+#
+# DO NOT EDIT THIS FILE.
+#
+# This file was generated automatically by converting the file located at
+# src/sbml/test/TestStoichiometryMath.c
+# using the conversion program dev/utilities/translateTests/translateTests.pl.
+# Any changes made here will be lost the next time the file is regenerated.
+#
+# -----------------------------------------------------------------------------
+# This file is part of libSBML. Please visit http://sbml.org for more
+# information about SBML, and the latest version of libSBML.
+#
+# Copyright 2005-2010 California Institute of Technology.
+# Copyright 2002-2005 California Institute of Technology and
+# Japan Science and Technology Corporation.
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation. A copy of the license agreement is provided
+# in the file named "LICENSE.txt" included with this software distribution
+# and also available online as http://sbml.org/software/libsbml/license.html
+# -----------------------------------------------------------------------------
+require 'test/unit'
+require 'libSBML'
+class TestStoichiometryMath < Test::Unit::TestCase
+
+ def setup
+ @@d = LibSBML::StoichiometryMath.new(2,4)
+ if (@@d == nil)
+ end
+ end
+
+ def teardown
+ @@d = nil
+ end
+
+ def test_StoichiometryMath_create
+ assert( @@d.getTypeCode() == LibSBML::SBML_STOICHIOMETRY_MATH )
+ assert( @@d.getMetaId() == "" )
+ assert( @@d.getNotes() == nil )
+ assert( @@d.getAnnotation() == nil )
+ assert( @@d.getMath() == nil )
+ end
+
+ def test_StoichiometryMath_createWithNS
+ xmlns = LibSBML::XMLNamespaces.new()
+ xmlns.add( "http://www.sbml.org", "testsbml")
+ sbmlns = LibSBML::SBMLNamespaces.new(2,1)
+ sbmlns.addNamespaces(xmlns)
+ object = LibSBML::StoichiometryMath.new(sbmlns)
+ assert( object.getTypeCode() == LibSBML::SBML_STOICHIOMETRY_MATH )
+ assert( object.getMetaId() == "" )
+ assert( object.getNotes() == nil )
+ assert( object.getAnnotation() == nil )
+ assert( object.getLevel() == 2 )
+ assert( object.getVersion() == 1 )
+ assert( object.getNamespaces() != nil )
+ assert( object.getNamespaces().getLength() == 2 )
+ object = nil
+ end
+
+ def test_StoichiometryMath_free_NULL
+ end
+
+ def test_StoichiometryMath_setMath
+ math = LibSBML::parseFormula("lambda(x, x^3)")
+ @@d.setMath(math)
+ math1 = @@d.getMath()
+ assert( math1 != nil )
+ formula = LibSBML::formulaToString(math1)
+ assert( formula != nil )
+ assert (( "lambda(x, x^3)" == formula ))
+ assert( @@d.getMath() != math )
+ assert_equal true, @@d.isSetMath()
+ @@d.setMath(@@d.getMath())
+ math1 = @@d.getMath()
+ assert( math1 != nil )
+ formula = LibSBML::formulaToString(math1)
+ assert( formula != nil )
+ assert (( "lambda(x, x^3)" == formula ))
+ @@d.setMath(nil)
+ assert_equal false, @@d.isSetMath()
+ if (@@d.getMath() != nil)
+ end
+ end
+
+ def test_StoichiometryMath_setMath1
+ math = LibSBML::parseFormula("2 * k")
+ i = @@d.setMath(math)
+ assert( i == LibSBML::LIBSBML_OPERATION_SUCCESS )
+ assert( @@d.getMath() != math )
+ assert_equal true, @@d.isSetMath()
+ i = @@d.setMath(nil)
+ assert( i == LibSBML::LIBSBML_OPERATION_SUCCESS )
+ assert( @@d.getMath() == nil )
+ assert_equal false, @@d.isSetMath()
+ math = nil
+ end
+
+ def test_StoichiometryMath_setMath2
+ math = LibSBML::ASTNode.new(LibSBML::AST_DIVIDE)
+ i = @@d.setMath(math)
+ assert( i == LibSBML::LIBSBML_INVALID_OBJECT )
+ assert_equal false, @@d.isSetMath()
+ math = nil
+ end
+
+end
Modified: trunk/libsbml/src/bindings/ruby/test/sbml/TestTrigger.rb
===================================================================
--- trunk/libsbml/src/bindings/ruby/test/sbml/TestTrigger.rb 2012-01-31 03:18:58 UTC (rev 15340)
+++ trunk/libsbml/src/bindings/ruby/test/sbml/TestTrigger.rb 2012-01-31 03:19:32 UTC (rev 15341)
@@ -1,118 +1,116 @@
-# @file TestTrigger.rb
-# @brief SBML Trigger unit tests
-#
-# @author Akiya Jouraku (Ruby conversion)
-# @author Sarah Keating
-#
-#
-# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
-#
-# DO NOT EDIT THIS FILE.
-#
-# This file was generated automatically by converting the file located at
-# src/sbml/test/TestTrigger.c
-# using the conversion program dev/utilities/translateTests/translateTests.pl.
-# Any changes made here will be lost the next time the file is regenerated.
-#
-# -----------------------------------------------------------------------------
-# This file is part of libSBML. Please visit http://sbml.org for more
-# information about SBML, and the latest version of libSBML.
-#
-# Copyright 2005-2010 California Institute of Technology.
-# Copyright 2002-2005 California Institute of Technology and
-# Japan Science and Technology Corporation.
-#
-# This library is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation. A copy of the license agreement is provided
-# in the file named "LICENSE.txt" included with this software distribution
-# and also available online as http://sbml.org/software/libsbml/license.html
-# -----------------------------------------------------------------------------
-require 'test/unit'
-require 'libSBML'
-
-class TestTrigger < Test::Unit::TestCase
-
- def setup
- @@d = LibSBML::Trigger.new(2,4)
- if (@@d == nil)
- end
- end
-
- def teardown
- @@d = nil
- end
-
- def test_Trigger_create
- assert( @@d.getTypeCode() == LibSBML::SBML_TRIGGER )
- assert( @@d.getMetaId() == "" )
- assert( @@d.getNotes() == nil )
- assert( @@d.getAnnotation() == nil )
- assert( @@d.getMath() == nil )
- end
-
- def test_Trigger_createWithNS
- xmlns = LibSBML::XMLNamespaces.new()
- xmlns.add( "http://www.sbml.org", "testsbml")
- sbmlns = LibSBML::SBMLNamespaces.new(2,1)
- sbmlns.addNamespaces(xmlns)
- object = LibSBML::Trigger.new(sbmlns)
- assert( object.getTypeCode() == LibSBML::SBML_TRIGGER )
- assert( object.getMetaId() == "" )
- assert( object.getNotes() == nil )
- assert( object.getAnnotation() == nil )
- assert( object.getLevel() == 2 )
- assert( object.getVersion() == 1 )
- assert( object.getNamespaces() != nil )
- assert( object.getNamespaces().getLength() == 2 )
- object = nil
- end
-
- def test_Trigger_free_NULL
- end
-
- def test_Trigger_setMath
- math = LibSBML::parseFormula("lambda(x, x^3)")
- @@d.setMath(math)
- math1 = @@d.getMath()
- assert( math1 != nil )
- formula = LibSBML::formulaToString(math1)
- assert( formula != nil )
- assert (( "lambda(x, x^3)" == formula ))
- assert( @@d.getMath() != math )
- assert_equal true, @@d.isSetMath()
- @@d.setMath(@@d.getMath())
- math1 = @@d.getMath()
- assert( math1 != nil )
- formula = LibSBML::formulaToString(math1)
- assert( formula != nil )
- assert (( "lambda(x, x^3)" == formula ))
- @@d.setMath(nil)
- assert_equal false, @@d.isSetMath()
- if (@@d.getMath() != nil)
- end
- end
-
- def test_Trigger_setMath1
- math = LibSBML::parseFormula("2 * k")
- i = @@d.setMath(math)
- assert( i == LibSBML::LIBSBML_OPERATION_SUCCESS )
- assert( @@d.getMath() != math )
- assert_equal true, @@d.isSetMath()
- i = @@d.setMath(nil)
- assert( i == LibSBML::LIBSBML_OPERATION_SUCCESS )
- assert( @@d.getMath() == nil )
- assert_equal false, @@d.isSetMath()
- math = nil
- end
-
- def test_Trigger_setMath2
- math = LibSBML::ASTNode.new(LibSBML::AST_TIMES)
- i = @@d.setMath(math)
- assert( i == LibSBML::LIBSBML_INVALID_OBJECT )
- assert_equal false, @@d.isSetMath()
- math = nil
- end
-
-end
+# @file TestTrigger.rb
+# @brief SBML Trigger unit tests
+#
+# @author Akiya Jouraku (Ruby conversion)
+# @author Sarah Keating
+#
+# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
+#
+# DO NOT EDIT THIS FILE.
+#
+# This file was generated automatically by converting the file located at
+# src/sbml/test/TestTrigger.c
+# using the conversion program dev/utilities/translateTests/translateTests.pl.
+# Any changes made here will be lost the next time the file is regenerated.
+#
+# -----------------------------------------------------------------------------
+# This file is part of libSBML. Please visit http://sbml.org for more
+# information about SBML, and the latest version of libSBML.
+#
+# Copyright 2005-2010 California Institute of Technology.
+# Copyright 2002-2005 California Institute of Technology and
+# Japan Science and Technology Corporation.
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation. A copy of the license agreement is provided
+# in the file named "LICENSE.txt" included with this software distribution
+# and also available online as http://sbml.org/software/libsbml/license.html
+# -----------------------------------------------------------------------------
+require 'test/unit'
+require 'libSBML'
+class TestTrigger < Test::Unit::TestCase
+
+ def setup
+ @@d = LibSBML::Trigger.new(2,4)
+ if (@@d == nil)
+ end
+ end
+
+ def teardown
+ @@d = nil
+ end
+
+ def test_Trigger_create
+ assert( @@d.getTypeCode() == LibSBML::SBML_TRIGGER )
+ assert( @@d.getMetaId() == "" )
+ assert( @@d.getNotes() == nil )
+ assert( @@d.getAnnotation() == nil )
+ assert( @@d.getMath() == nil )
+ end
+
+ def test_Trigger_createWithNS
+ xmlns = LibSBML::XMLNamespaces.new()
+ xmlns.add( "http://www.sbml.org", "testsbml")
+ sbmlns = LibSBML::SBMLNamespaces.new(2,1)
+ sbmlns.addNamespaces(xmlns)
+ object = LibSBML::Trigger.new(sbmlns)
+ assert( object.getTypeCode() == LibSBML::SBML_TRIGGER )
+ assert( object.getMetaId() == "" )
+ assert( object.getNotes() == nil )
+ assert( object.getAnnotation() == nil )
+ assert( object.getLevel() == 2 )
+ assert( object.getVersion() == 1 )
+ assert( object.getNamespaces() != nil )
+ assert( object.getNamespaces().getLength() == 2 )
+ object = nil
+ end
+
+ def test_Trigger_free_NULL
+ end
+
+ def test_Trigger_setMath
+ math = LibSBML::parseFormula("lambda(x, x^3)")
+ @@d.setMath(math)
+ math1 = @@d.getMath()
+ assert( math1 != nil )
+ formula = LibSBML::formulaToString(math1)
+ assert( formula != nil )
+ assert (( "lambda(x, x^3)" == formula ))
+ assert( @@d.getMath() != math )
+ assert_equal true, @@d.isSetMath()
+ @@d.setMath(@@d.getMath())
+ math1 = @@d.getMath()
+ assert( math1 != nil )
+ formula = LibSBML::formulaToString(math1)
+ assert( formula != nil )
+ assert (( "lambda(x, x^3)" == formula ))
+ @@d.setMath(nil)
+ assert_equal false, @@d.isSetMath()
+ if (@@d.getMath() != nil)
+ end
+ end
+
+ def test_Trigger_setMath1
+ math = LibSBML::parseFormula("2 * k")
+ i = @@d.setMath(math)
+ assert( i == LibSBML::LIBSBML_OPERATION_SUCCESS )
+ assert( @@d.getMath() != math )
+ assert_equal true, @@d.isSetMath()
+ i = @@d.setMath(nil)
+ assert( i == LibSBML::LIBSBML_OPERATION_SUCCESS )
+ assert( @@d.getMath() == nil )
+ assert_equal false, @@d.isSetMath()
+ math = nil
+ end
+
+ def test_Trigger_setMath2
+ math = LibSBML::ASTNode.new(LibSBML::AST_DIVIDE)
+ i = @@d.setMath(math)
+ assert( i == LibSBML::LIBSBML_INVALID_OBJECT )
+ assert_equal false, @@d.isSetMath()
+ math = nil
+ end
+
+end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fbe...@us...> - 2012-01-31 03:19:05
|
Revision: 15340
http://sbml.svn.sourceforge.net/sbml/?rev=15340&view=rev
Author: fbergmann
Date: 2012-01-31 03:18:58 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
- converted changed python tests
Modified Paths:
--------------
trunk/libsbml/src/bindings/python/test/math/TestValidASTNode.py
trunk/libsbml/src/bindings/python/test/sbml/TestConstraint_newSetters.py
trunk/libsbml/src/bindings/python/test/sbml/TestDelay.py
trunk/libsbml/src/bindings/python/test/sbml/TestEventAssignment_newSetters.py
trunk/libsbml/src/bindings/python/test/sbml/TestFunctionDefinition_newSetters.py
trunk/libsbml/src/bindings/python/test/sbml/TestInitialAssignment_newSetters.py
trunk/libsbml/src/bindings/python/test/sbml/TestKineticLaw_newSetters.py
trunk/libsbml/src/bindings/python/test/sbml/TestPriority.py
trunk/libsbml/src/bindings/python/test/sbml/TestRule_newSetters.py
trunk/libsbml/src/bindings/python/test/sbml/TestStoichiometryMath.py
trunk/libsbml/src/bindings/python/test/sbml/TestTrigger.py
Modified: trunk/libsbml/src/bindings/python/test/math/TestValidASTNode.py
===================================================================
--- trunk/libsbml/src/bindings/python/test/math/TestValidASTNode.py 2012-01-31 03:17:50 UTC (rev 15339)
+++ trunk/libsbml/src/bindings/python/test/math/TestValidASTNode.py 2012-01-31 03:18:58 UTC (rev 15340)
@@ -10,7 +10,7 @@
# DO NOT EDIT THIS FILE.
#
# This file was generated automatically by converting the file located at
-# src/math/test/TestValidASTNode.cpp
+# src/sbml/test/TestValidASTNode.cpp
# using the conversion program dev/utilities/translateTests/translateTests.pl.
# Any changes made here will be lost the next time the file is regenerated.
#
@@ -67,6 +67,64 @@
n = None
pass
+ def test_ValidASTNode_infix_nary_plus0(self):
+ n = libsbml.readMathMLFromString("<math xmlns='http://www.w3.org/1998/Math/MathML'>" +
+ " <apply>" +
+ " <plus/>" +
+ " </apply>" +
+ "</math>")
+ self.assert_( n != None )
+ formula = libsbml.formulaToString(n)
+ node = libsbml.parseFormula(formula)
+ self.assert_( node != None )
+ n = None
+ node = None
+ pass
+
+ def test_ValidASTNode_infix_nary_plus1(self):
+ n = libsbml.readMathMLFromString("<math xmlns='http://www.w3.org/1998/Math/MathML'>" +
+ " <apply>" +
+ " <plus/>" +
+ " <cn> 0 </cn>" +
+ " </apply>" +
+ "</math>")
+ self.assert_( n != None )
+ formula = libsbml.formulaToString(n)
+ node = libsbml.parseFormula(formula)
+ self.assert_( node != None )
+ n = None
+ node = None
+ pass
+
+ def test_ValidASTNode_infix_nary_times0(self):
+ n = libsbml.readMathMLFromString("<math xmlns='http://www.w3.org/1998/Math/MathML'>" +
+ " <apply>" +
+ " <times/>" +
+ " </apply>" +
+ "</math>")
+ self.assert_( n != None )
+ formula = libsbml.formulaToString(n)
+ node = libsbml.parseFormula(formula)
+ self.assert_( node != None )
+ n = None
+ node = None
+ pass
+
+ def test_ValidASTNode_infix_nary_times1(self):
+ n = libsbml.readMathMLFromString("<math xmlns='http://www.w3.org/1998/Math/MathML'>" +
+ " <apply>" +
+ " <times/>" +
+ " <cn> 0 </cn>" +
+ " </apply>" +
+ "</math>")
+ self.assert_( n != None )
+ formula = libsbml.formulaToString(n)
+ node = libsbml.parseFormula(formula)
+ self.assert_( node != None )
+ n = None
+ node = None
+ pass
+
def test_ValidASTNode_lambda(self):
n = libsbml.ASTNode(libsbml.AST_LAMBDA)
self.assertEqual( False, (n.isWellFormedASTNode()) )
@@ -83,11 +141,19 @@
pass
def test_ValidASTNode_nary(self):
- n = libsbml.ASTNode(libsbml.AST_TIMES)
+ n = libsbml.ASTNode(libsbml.AST_DIVIDE)
self.assertEqual( False, (n.isWellFormedASTNode()) )
c = libsbml.parseFormula("c")
+ n.addChild(c.deepCopy())
+ self.assertEqual( False, (n.isWellFormedASTNode()) )
+ n.addChild(c.deepCopy())
+ self.assertEqual( True, (n.isWellFormedASTNode()) )
+ n.addChild(c.deepCopy())
+ self.assertEqual( False, (n.isWellFormedASTNode()) )
+ n = libsbml.ASTNode(libsbml.AST_TIMES)
+ self.assertEqual( True, (n.isWellFormedASTNode()) )
n.addChild(c)
- self.assertEqual( False, (n.isWellFormedASTNode()) )
+ self.assertEqual( True, (n.isWellFormedASTNode()) )
d = libsbml.parseFormula("d")
n.addChild(d)
self.assertEqual( True, n.isWellFormedASTNode() )
@@ -97,6 +163,35 @@
n = None
pass
+ def test_ValidASTNode_returnsBoolean(self):
+ node = libsbml.ASTNode( libsbml.AST_LOGICAL_AND )
+ self.assertEqual( True, node.returnsBoolean() )
+ node.setType(libsbml.AST_LOGICAL_NOT)
+ self.assertEqual( True, node.returnsBoolean() )
+ node.setType(libsbml.AST_LOGICAL_OR)
+ self.assertEqual( True, node.returnsBoolean() )
+ node.setType(libsbml.AST_LOGICAL_XOR)
+ self.assertEqual( True, node.returnsBoolean() )
+ node.setType(libsbml.AST_FUNCTION_PIECEWISE)
+ self.assertEqual( True, node.returnsBoolean() )
+ node.setType(libsbml.AST_RELATIONAL_EQ)
+ self.assertEqual( True, node.returnsBoolean() )
+ node.setType(libsbml.AST_RELATIONAL_GEQ)
+ self.assertEqual( True, node.returnsBoolean() )
+ node.setType(libsbml.AST_RELATIONAL_GT)
+ self.assertEqual( True, node.returnsBoolean() )
+ node.setType(libsbml.AST_RELATIONAL_LEQ)
+ self.assertEqual( True, node.returnsBoolean() )
+ node.setType(libsbml.AST_RELATIONAL_LT)
+ self.assertEqual( True, node.returnsBoolean() )
+ node.setType(libsbml.AST_RELATIONAL_NEQ)
+ self.assertEqual( True, node.returnsBoolean() )
+ node.setType(libsbml.AST_CONSTANT_TRUE)
+ self.assertEqual( True, node.returnsBoolean() )
+ node.setType(libsbml.AST_CONSTANT_FALSE)
+ self.assertEqual( True, node.returnsBoolean() )
+ pass
+
def test_ValidASTNode_root(self):
n = libsbml.ASTNode(libsbml.AST_FUNCTION_ROOT)
self.assertEqual( False, (n.isWellFormedASTNode()) )
Modified: trunk/libsbml/src/bindings/python/test/sbml/TestConstraint_newSetters.py
===================================================================
--- trunk/libsbml/src/bindings/python/test/sbml/TestConstraint_newSetters.py 2012-01-31 03:17:50 UTC (rev 15339)
+++ trunk/libsbml/src/bindings/python/test/sbml/TestConstraint_newSetters.py 2012-01-31 03:18:58 UTC (rev 15340)
@@ -1,10 +1,9 @@
#
# @file TestConstraint_newSetters.py
-# @brief Constraint unit tests for new set function API
+# @brief Constraint unit tests for new set function API
#
# @author Akiya Jouraku (Python conversion)
-# @author Sarah Keating
-
+# @author Sarah Keating
#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
@@ -64,7 +63,7 @@
pass
def test_Constraint_setMath2(self):
- math = libsbml.ASTNode(libsbml.AST_TIMES)
+ math = libsbml.ASTNode(libsbml.AST_DIVIDE)
i = self.C.setMath(math)
self.assert_( i == libsbml.LIBSBML_INVALID_OBJECT )
self.assertEqual( False, self.C.isSetMath() )
Modified: trunk/libsbml/src/bindings/python/test/sbml/TestDelay.py
===================================================================
--- trunk/libsbml/src/bindings/python/test/sbml/TestDelay.py 2012-01-31 03:17:50 UTC (rev 15339)
+++ trunk/libsbml/src/bindings/python/test/sbml/TestDelay.py 2012-01-31 03:18:58 UTC (rev 15340)
@@ -114,7 +114,7 @@
pass
def test_Delay_setMath2(self):
- math = libsbml.ASTNode(libsbml.AST_TIMES)
+ math = libsbml.ASTNode(libsbml.AST_DIVIDE)
i = self.D.setMath(math)
self.assert_( i == libsbml.LIBSBML_INVALID_OBJECT )
self.assertEqual( False, self.D.isSetMath() )
@@ -132,4 +132,3 @@
sys.exit(0)
else:
sys.exit(1)
-
Modified: trunk/libsbml/src/bindings/python/test/sbml/TestEventAssignment_newSetters.py
===================================================================
--- trunk/libsbml/src/bindings/python/test/sbml/TestEventAssignment_newSetters.py 2012-01-31 03:17:50 UTC (rev 15339)
+++ trunk/libsbml/src/bindings/python/test/sbml/TestEventAssignment_newSetters.py 2012-01-31 03:18:58 UTC (rev 15340)
@@ -1,10 +1,9 @@
#
# @file TestEventAssignment_newSetters.py
-# @brief EventAssignment unit tests for new set function API
+# @brief EventAssignment unit tests for new set function API
#
# @author Akiya Jouraku (Python conversion)
-# @author Sarah Keating
-
+# @author Sarah Keating
#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
@@ -64,7 +63,7 @@
pass
def test_EventAssignment_setMath2(self):
- math = libsbml.ASTNode(libsbml.AST_TIMES)
+ math = libsbml.ASTNode(libsbml.AST_DIVIDE)
i = self.E.setMath(math)
self.assert_( i == libsbml.LIBSBML_INVALID_OBJECT )
self.assertEqual( False, self.E.isSetMath() )
@@ -72,14 +71,14 @@
pass
def test_EventAssignment_setVariable1(self):
- id = "1e1";
+ id = "1e1";
i = self.E.setVariable(id)
self.assert_( i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE )
self.assertEqual( False, self.E.isSetVariable() )
pass
def test_EventAssignment_setVariable2(self):
- id = "e1";
+ id = "e1";
i = self.E.setVariable(id)
self.assert_( i == libsbml.LIBSBML_OPERATION_SUCCESS )
self.assert_(( id == self.E.getVariable() ))
Modified: trunk/libsbml/src/bindings/python/test/sbml/TestFunctionDefinition_newSetters.py
===================================================================
--- trunk/libsbml/src/bindings/python/test/sbml/TestFunctionDefinition_newSetters.py 2012-01-31 03:17:50 UTC (rev 15339)
+++ trunk/libsbml/src/bindings/python/test/sbml/TestFunctionDefinition_newSetters.py 2012-01-31 03:18:58 UTC (rev 15340)
@@ -1,10 +1,9 @@
#
# @file TestFunctionDefinition_newSetters.py
-# @brief FunctionDefinition unit tests for new set function API
+# @brief FunctionDefinition unit tests for new set function API
#
# @author Akiya Jouraku (Python conversion)
-# @author Sarah Keating
-
+# @author Sarah Keating
#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
@@ -51,14 +50,14 @@
pass
def test_FunctionDefinition_setId1(self):
- id = "1e1";
+ id = "1e1";
i = self.E.setId(id)
self.assert_( i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE )
self.assertEqual( False, self.E.isSetId() )
pass
def test_FunctionDefinition_setId2(self):
- id = "e1";
+ id = "e1";
i = self.E.setId(id)
self.assert_( i == libsbml.LIBSBML_OPERATION_SUCCESS )
self.assert_(( id == self.E.getId() ))
@@ -82,7 +81,7 @@
pass
def test_FunctionDefinition_setMath2(self):
- math = libsbml.ASTNode(libsbml.AST_TIMES)
+ math = libsbml.ASTNode(libsbml.AST_DIVIDE)
i = self.E.setMath(math)
self.assert_( i == libsbml.LIBSBML_INVALID_OBJECT )
self.assertEqual( False, self.E.isSetMath() )
@@ -90,14 +89,14 @@
pass
def test_FunctionDefinition_setName1(self):
- name = "3Set_k2";
+ name = "3Set_k2";
i = self.E.setName(name)
self.assert_( i == libsbml.LIBSBML_OPERATION_SUCCESS )
self.assertEqual( True, self.E.isSetName() )
pass
def test_FunctionDefinition_setName2(self):
- name = "Set k2";
+ name = "Set k2";
i = self.E.setName(name)
self.assert_( i == libsbml.LIBSBML_OPERATION_SUCCESS )
self.assert_(( name == self.E.getName() ))
Modified: trunk/libsbml/src/bindings/python/test/sbml/TestInitialAssignment_newSetters.py
===================================================================
--- trunk/libsbml/src/bindings/python/test/sbml/TestInitialAssignment_newSetters.py 2012-01-31 03:17:50 UTC (rev 15339)
+++ trunk/libsbml/src/bindings/python/test/sbml/TestInitialAssignment_newSetters.py 2012-01-31 03:18:58 UTC (rev 15340)
@@ -1,10 +1,9 @@
#
# @file TestInitialAssignment_newSetters.py
-# @brief InitialAssignment unit tests for new set function API
+# @brief InitialAssignment unit tests for new set function API
#
# @author Akiya Jouraku (Python conversion)
-# @author Sarah Keating
-
+# @author Sarah Keating
#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
@@ -64,7 +63,7 @@
pass
def test_InitialAssignment_setMath2(self):
- math = libsbml.ASTNode(libsbml.AST_TIMES)
+ math = libsbml.ASTNode(libsbml.AST_DIVIDE)
i = self.E.setMath(math)
self.assert_( i == libsbml.LIBSBML_INVALID_OBJECT )
self.assertEqual( False, self.E.isSetMath() )
@@ -72,14 +71,14 @@
pass
def test_InitialAssignment_setSymbol1(self):
- id = "1e1";
+ id = "1e1";
i = self.E.setSymbol(id)
self.assert_( i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE )
self.assertEqual( False, self.E.isSetSymbol() )
pass
def test_InitialAssignment_setSymbol2(self):
- id = "e1";
+ id = "e1";
i = self.E.setSymbol(id)
self.assert_( i == libsbml.LIBSBML_OPERATION_SUCCESS )
self.assert_(( id == self.E.getSymbol() ))
Modified: trunk/libsbml/src/bindings/python/test/sbml/TestKineticLaw_newSetters.py
===================================================================
--- trunk/libsbml/src/bindings/python/test/sbml/TestKineticLaw_newSetters.py 2012-01-31 03:17:50 UTC (rev 15339)
+++ trunk/libsbml/src/bindings/python/test/sbml/TestKineticLaw_newSetters.py 2012-01-31 03:18:58 UTC (rev 15340)
@@ -1,10 +1,9 @@
#
# @file TestKineticLaw_newSetters.py
-# @brief KineticLaw unit tests for new set function API
+# @brief KineticLaw unit tests for new set function API
#
# @author Akiya Jouraku (Python conversion)
-# @author Sarah Keating
-
+# @author Sarah Keating
#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
@@ -104,7 +103,7 @@
pass
def test_KineticLaw_setFormula1(self):
- formula = "k1*X0";
+ formula = "k1*X0";
i = self.kl.setFormula(formula)
self.assert_( i == libsbml.LIBSBML_OPERATION_SUCCESS )
self.assert_(( formula == self.kl.getFormula() ))
@@ -118,7 +117,7 @@
pass
def test_KineticLaw_setFormula3(self):
- formula = "k1 X0";
+ formula = "k1 X0";
i = self.kl.setFormula(formula)
self.assert_( i == libsbml.LIBSBML_INVALID_OBJECT )
self.assertEqual( False, self.kl.isSetFormula() )
@@ -144,7 +143,7 @@
pass
def test_KineticLaw_setMath2(self):
- math = libsbml.ASTNode(libsbml.AST_TIMES)
+ math = libsbml.ASTNode(libsbml.AST_DIVIDE)
a = libsbml.ASTNode()
a.setName( "a")
math.addChild(a)
@@ -249,4 +248,3 @@
sys.exit(0)
else:
sys.exit(1)
-
Modified: trunk/libsbml/src/bindings/python/test/sbml/TestPriority.py
===================================================================
--- trunk/libsbml/src/bindings/python/test/sbml/TestPriority.py 2012-01-31 03:17:50 UTC (rev 15339)
+++ trunk/libsbml/src/bindings/python/test/sbml/TestPriority.py 2012-01-31 03:18:58 UTC (rev 15340)
@@ -1,135 +1,134 @@
-#
-# @file TestPriority.py
-# @brief SBML Priority unit tests
-#
-# @author Akiya Jouraku (Python conversion)
-# @author Sarah Keating
+#
+# @file TestPriority.py
+# @brief SBML Priority unit tests
+#
+# @author Akiya Jouraku (Python conversion)
+# @author Sarah Keating
#
-# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
-#
-# DO NOT EDIT THIS FILE.
-#
-# This file was generated automatically by converting the file located at
-# src/sbml/test/TestPriority.c
-# using the conversion program dev/utilities/translateTests/translateTests.pl.
-# Any changes made here will be lost the next time the file is regenerated.
-#
-# -----------------------------------------------------------------------------
-# This file is part of libSBML. Please visit http://sbml.org for more
-# information about SBML, and the latest version of libSBML.
-#
-# Copyright 2005-2010 California Institute of Technology.
-# Copyright 2002-2005 California Institute of Technology and
-# Japan Science and Technology Corporation.
-#
-# This library is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation. A copy of the license agreement is provided
-# in the file named "LICENSE.txt" included with this software distribution
-# and also available online as http://sbml.org/software/libsbml/license.html
-# -----------------------------------------------------------------------------
-
-import sys
-import unittest
-import libsbml
-
-
-class TestPriority(unittest.TestCase):
-
- global P
- P = None
-
- def setUp(self):
- self.P = libsbml.Priority(3,1)
- if (self.P == None):
- pass
- pass
-
- def tearDown(self):
- _dummyList = [ self.P ]; _dummyList[:] = []; del _dummyList
- pass
-
- def test_Priority_create(self):
- self.assert_( self.P.getTypeCode() == libsbml.SBML_PRIORITY )
- self.assert_( self.P.getMetaId() == "" )
- self.assert_( self.P.getNotes() == None )
- self.assert_( self.P.getAnnotation() == None )
- self.assert_( self.P.getMath() == None )
- pass
-
- def test_Priority_createWithNS(self):
- xmlns = libsbml.XMLNamespaces()
- xmlns.add( "http://www.sbml.org", "testsbml")
- sbmlns = libsbml.SBMLNamespaces(3,1)
- sbmlns.addNamespaces(xmlns)
- object = libsbml.Priority(sbmlns)
- self.assert_( object.getTypeCode() == libsbml.SBML_PRIORITY )
- self.assert_( object.getMetaId() == "" )
- self.assert_( object.getNotes() == None )
- self.assert_( object.getAnnotation() == None )
- self.assert_( object.getLevel() == 3 )
- self.assert_( object.getVersion() == 1 )
- self.assert_( object.getNamespaces() != None )
- self.assert_( object.getNamespaces().getLength() == 2 )
- _dummyList = [ object ]; _dummyList[:] = []; del _dummyList
- pass
-
- def test_Priority_free_NULL(self):
- _dummyList = [ None ]; _dummyList[:] = []; del _dummyList
- pass
-
- def test_Priority_setMath(self):
- math = libsbml.parseFormula("lambda(x, x^3)")
- self.P.setMath(math)
- math1 = self.P.getMath()
- self.assert_( math1 != None )
- formula = libsbml.formulaToString(math1)
- self.assert_( formula != None )
- self.assert_(( "lambda(x, x^3)" == formula ))
- self.assert_( self.P.getMath() != math )
- self.assertEqual( True, self.P.isSetMath() )
- self.P.setMath(self.P.getMath())
- math1 = self.P.getMath()
- self.assert_( math1 != None )
- formula = libsbml.formulaToString(math1)
- self.assert_( formula != None )
- self.assert_(( "lambda(x, x^3)" == formula ))
- self.P.setMath(None)
- self.assertEqual( False, self.P.isSetMath() )
- if (self.P.getMath() != None):
- pass
- pass
-
- def test_Priority_setMath1(self):
- math = libsbml.parseFormula("2 * k")
- i = self.P.setMath(math)
- self.assert_( i == libsbml.LIBSBML_OPERATION_SUCCESS )
- self.assert_( self.P.getMath() != math )
- self.assertEqual( True, self.P.isSetMath() )
- i = self.P.setMath(None)
- self.assert_( i == libsbml.LIBSBML_OPERATION_SUCCESS )
- self.assert_( self.P.getMath() == None )
- self.assertEqual( False, self.P.isSetMath() )
- _dummyList = [ math ]; _dummyList[:] = []; del _dummyList
- pass
-
- def test_Priority_setMath2(self):
- math = libsbml.ASTNode(libsbml.AST_TIMES)
- i = self.P.setMath(math)
- self.assert_( i == libsbml.LIBSBML_INVALID_OBJECT )
- self.assertEqual( False, self.P.isSetMath() )
- _dummyList = [ math ]; _dummyList[:] = []; del _dummyList
- pass
-
-def suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestPriority))
-
- return suite
-
-if __name__ == "__main__":
- if unittest.TextTestRunner(verbosity=1).run(suite()).wasSuccessful() :
- sys.exit(0)
- else:
- sys.exit(1)
+# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
+#
+# DO NOT EDIT THIS FILE.
+#
+# This file was generated automatically by converting the file located at
+# src/sbml/test/TestPriority.c
+# using the conversion program dev/utilities/translateTests/translateTests.pl.
+# Any changes made here will be lost the next time the file is regenerated.
+#
+# -----------------------------------------------------------------------------
+# This file is part of libSBML. Please visit http://sbml.org for more
+# information about SBML, and the latest version of libSBML.
+#
+# Copyright 2005-2010 California Institute of Technology.
+# Copyright 2002-2005 California Institute of Technology and
+# Japan Science and Technology Corporation.
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation. A copy of the license agreement is provided
+# in the file named "LICENSE.txt" included with this software distribution
+# and also available online as http://sbml.org/software/libsbml/license.html
+# -----------------------------------------------------------------------------
+import sys
+import unittest
+import libsbml
+
+
+class TestPriority(unittest.TestCase):
+
+ global P
+ P = None
+
+ def setUp(self):
+ self.P = libsbml.Priority(3,1)
+ if (self.P == None):
+ pass
+ pass
+
+ def tearDown(self):
+ _dummyList = [ self.P ]; _dummyList[:] = []; del _dummyList
+ pass
+
+ def test_Priority_create(self):
+ self.assert_( self.P.getTypeCode() == libsbml.SBML_PRIORITY )
+ self.assert_( self.P.getMetaId() == "" )
+ self.assert_( self.P.getNotes() == None )
+ self.assert_( self.P.getAnnotation() == None )
+ self.assert_( self.P.getMath() == None )
+ pass
+
+ def test_Priority_createWithNS(self):
+ xmlns = libsbml.XMLNamespaces()
+ xmlns.add( "http://www.sbml.org", "testsbml")
+ sbmlns = libsbml.SBMLNamespaces(3,1)
+ sbmlns.addNamespaces(xmlns)
+ object = libsbml.Priority(sbmlns)
+ self.assert_( object.getTypeCode() == libsbml.SBML_PRIORITY )
+ self.assert_( object.getMetaId() == "" )
+ self.assert_( object.getNotes() == None )
+ self.assert_( object.getAnnotation() == None )
+ self.assert_( object.getLevel() == 3 )
+ self.assert_( object.getVersion() == 1 )
+ self.assert_( object.getNamespaces() != None )
+ self.assert_( object.getNamespaces().getLength() == 2 )
+ _dummyList = [ object ]; _dummyList[:] = []; del _dummyList
+ pass
+
+ def test_Priority_free_NULL(self):
+ _dummyList = [ None ]; _dummyList[:] = []; del _dummyList
+ pass
+
+ def test_Priority_setMath(self):
+ math = libsbml.parseFormula("lambda(x, x^3)")
+ self.P.setMath(math)
+ math1 = self.P.getMath()
+ self.assert_( math1 != None )
+ formula = libsbml.formulaToString(math1)
+ self.assert_( formula != None )
+ self.assert_(( "lambda(x, x^3)" == formula ))
+ self.assert_( self.P.getMath() != math )
+ self.assertEqual( True, self.P.isSetMath() )
+ self.P.setMath(self.P.getMath())
+ math1 = self.P.getMath()
+ self.assert_( math1 != None )
+ formula = libsbml.formulaToString(math1)
+ self.assert_( formula != None )
+ self.assert_(( "lambda(x, x^3)" == formula ))
+ self.P.setMath(None)
+ self.assertEqual( False, self.P.isSetMath() )
+ if (self.P.getMath() != None):
+ pass
+ pass
+
+ def test_Priority_setMath1(self):
+ math = libsbml.parseFormula("2 * k")
+ i = self.P.setMath(math)
+ self.assert_( i == libsbml.LIBSBML_OPERATION_SUCCESS )
+ self.assert_( self.P.getMath() != math )
+ self.assertEqual( True, self.P.isSetMath() )
+ i = self.P.setMath(None)
+ self.assert_( i == libsbml.LIBSBML_OPERATION_SUCCESS )
+ self.assert_( self.P.getMath() == None )
+ self.assertEqual( False, self.P.isSetMath() )
+ _dummyList = [ math ]; _dummyList[:] = []; del _dummyList
+ pass
+
+ def test_Priority_setMath2(self):
+ math = libsbml.ASTNode(libsbml.AST_DIVIDE)
+ i = self.P.setMath(math)
+ self.assert_( i == libsbml.LIBSBML_INVALID_OBJECT )
+ self.assertEqual( False, self.P.isSetMath() )
+ _dummyList = [ math ]; _dummyList[:] = []; del _dummyList
+ pass
+
+def suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestPriority))
+
+ return suite
+
+if __name__ == "__main__":
+ if unittest.TextTestRunner(verbosity=1).run(suite()).wasSuccessful() :
+ sys.exit(0)
+ else:
+ sys.exit(1)
Modified: trunk/libsbml/src/bindings/python/test/sbml/TestRule_newSetters.py
===================================================================
--- trunk/libsbml/src/bindings/python/test/sbml/TestRule_newSetters.py 2012-01-31 03:17:50 UTC (rev 15339)
+++ trunk/libsbml/src/bindings/python/test/sbml/TestRule_newSetters.py 2012-01-31 03:18:58 UTC (rev 15340)
@@ -1,10 +1,9 @@
#
# @file TestRule_newSetters.py
-# @brief Rule unit tests for new set function API
+# @brief Rule unit tests for new set function API
#
# @author Akiya Jouraku (Python conversion)
-# @author Sarah Keating
-
+# @author Sarah Keating
#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
@@ -51,7 +50,7 @@
pass
def test_Rule_setFormula1(self):
- formula = "k1*X0";
+ formula = "k1*X0";
i = self.R.setFormula(formula)
self.assert_( i == libsbml.LIBSBML_OPERATION_SUCCESS )
self.assert_(( formula == self.R.getFormula() ))
@@ -65,7 +64,7 @@
pass
def test_Rule_setFormula3(self):
- formula = "k1 X0";
+ formula = "k1 X0";
i = self.R.setFormula(formula)
self.assert_( i == libsbml.LIBSBML_INVALID_OBJECT )
self.assertEqual( False, self.R.isSetFormula() )
@@ -91,7 +90,7 @@
pass
def test_Rule_setMath2(self):
- math = libsbml.ASTNode(libsbml.AST_TIMES)
+ math = libsbml.ASTNode(libsbml.AST_DIVIDE)
a = libsbml.ASTNode()
a.setName( "a")
math.addChild(a)
@@ -183,4 +182,3 @@
sys.exit(0)
else:
sys.exit(1)
-
Modified: trunk/libsbml/src/bindings/python/test/sbml/TestStoichiometryMath.py
===================================================================
--- trunk/libsbml/src/bindings/python/test/sbml/TestStoichiometryMath.py 2012-01-31 03:17:50 UTC (rev 15339)
+++ trunk/libsbml/src/bindings/python/test/sbml/TestStoichiometryMath.py 2012-01-31 03:18:58 UTC (rev 15340)
@@ -114,7 +114,7 @@
pass
def test_StoichiometryMath_setMath2(self):
- math = libsbml.ASTNode(libsbml.AST_TIMES)
+ math = libsbml.ASTNode(libsbml.AST_DIVIDE)
i = self.D.setMath(math)
self.assert_( i == libsbml.LIBSBML_INVALID_OBJECT )
self.assertEqual( False, self.D.isSetMath() )
@@ -132,4 +132,3 @@
sys.exit(0)
else:
sys.exit(1)
-
Modified: trunk/libsbml/src/bindings/python/test/sbml/TestTrigger.py
===================================================================
--- trunk/libsbml/src/bindings/python/test/sbml/TestTrigger.py 2012-01-31 03:17:50 UTC (rev 15339)
+++ trunk/libsbml/src/bindings/python/test/sbml/TestTrigger.py 2012-01-31 03:18:58 UTC (rev 15340)
@@ -114,7 +114,7 @@
pass
def test_Trigger_setMath2(self):
- math = libsbml.ASTNode(libsbml.AST_TIMES)
+ math = libsbml.ASTNode(libsbml.AST_DIVIDE)
i = self.D.setMath(math)
self.assert_( i == libsbml.LIBSBML_INVALID_OBJECT )
self.assertEqual( False, self.D.isSetMath() )
@@ -132,4 +132,3 @@
sys.exit(0)
else:
sys.exit(1)
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fbe...@us...> - 2012-01-31 03:17:57
|
Revision: 15339
http://sbml.svn.sourceforge.net/sbml/?rev=15339&view=rev
Author: fbergmann
Date: 2012-01-31 03:17:50 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
- changed to have it converted easier
Modified Paths:
--------------
trunk/libsbml/src/sbml/math/test/TestValidASTNode.cpp
Modified: trunk/libsbml/src/sbml/math/test/TestValidASTNode.cpp
===================================================================
--- trunk/libsbml/src/sbml/math/test/TestValidASTNode.cpp 2012-01-31 02:57:57 UTC (rev 15338)
+++ trunk/libsbml/src/sbml/math/test/TestValidASTNode.cpp 2012-01-31 03:17:50 UTC (rev 15339)
@@ -61,9 +61,9 @@
fail_unless( n != NULL );
- string formula = SBML_formulaToString(n);
+ char* formula = SBML_formulaToString(n);
- ASTNode *node = SBML_parseFormula(formula.c_str());
+ ASTNode *node = SBML_parseFormula(formula);
fail_unless( node != NULL );
@@ -85,9 +85,9 @@
fail_unless( n != NULL );
- string formula = SBML_formulaToString(n);
+ char* formula = SBML_formulaToString(n);
- ASTNode *node = SBML_parseFormula(formula.c_str());
+ ASTNode *node = SBML_parseFormula(formula);
fail_unless( node != NULL );
@@ -108,9 +108,9 @@
fail_unless( n != NULL );
- string formula = SBML_formulaToString(n);
+ char* formula = SBML_formulaToString(n);
- ASTNode *node = SBML_parseFormula(formula.c_str());
+ ASTNode *node = SBML_parseFormula(formula);
fail_unless( node != NULL );
@@ -133,9 +133,9 @@
fail_unless( n != NULL );
- string formula = SBML_formulaToString(n);
+ char* formula = SBML_formulaToString(n);
- ASTNode *node = SBML_parseFormula(formula.c_str());
+ ASTNode *node = SBML_parseFormula(formula);
fail_unless( node != NULL );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fbe...@us...> - 2012-01-31 02:58:04
|
Revision: 15338
http://sbml.svn.sourceforge.net/sbml/?rev=15338&view=rev
Author: fbergmann
Date: 2012-01-31 02:57:57 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
- modified test to take garbage collection into account
Modified Paths:
--------------
trunk/libsbml/src/sbml/math/test/TestValidASTNode.cpp
Modified: trunk/libsbml/src/sbml/math/test/TestValidASTNode.cpp
===================================================================
--- trunk/libsbml/src/sbml/math/test/TestValidASTNode.cpp 2012-01-31 02:07:14 UTC (rev 15337)
+++ trunk/libsbml/src/sbml/math/test/TestValidASTNode.cpp 2012-01-31 02:57:57 UTC (rev 15338)
@@ -226,13 +226,13 @@
ASTNode *c = SBML_parseFormula("c");
- n->addChild(c);
+ n->addChild(c->deepCopy());
fail_unless( !(n->isWellFormedASTNode()) );
- n->addChild(c);
+ n->addChild(c->deepCopy());
fail_unless( (n->isWellFormedASTNode()) );
- n->addChild(c);
+ n->addChild(c->deepCopy());
fail_unless( !(n->isWellFormedASTNode()) );
n = new ASTNode(AST_TIMES);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fbe...@us...> - 2012-01-31 02:07:21
|
Revision: 15337
http://sbml.svn.sourceforge.net/sbml/?rev=15337&view=rev
Author: fbergmann
Date: 2012-01-31 02:07:14 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
- add piecewise evaluation for even numbered arguments, and added tests
Modified Paths:
--------------
trunk/libsbml/src/sbml/SBMLTransforms.cpp
trunk/libsbml/src/sbml/test/TestSBMLTransforms.cpp
Modified: trunk/libsbml/src/sbml/SBMLTransforms.cpp
===================================================================
--- trunk/libsbml/src/sbml/SBMLTransforms.cpp 2012-01-31 01:47:11 UTC (rev 15336)
+++ trunk/libsbml/src/sbml/SBMLTransforms.cpp 2012-01-31 02:07:14 UTC (rev 15337)
@@ -718,10 +718,25 @@
case AST_FUNCTION_PIECEWISE:
{
unsigned int numChildren = node->getNumChildren();
- if ( numChildren == 0 || numChildren == 2)
+ if ( numChildren % 2 == 0)
{
- /* cannot do this */
- result = numeric_limits<double>::quiet_NaN();
+ bool assigned = false;
+ for (unsigned int i = 0; i < numChildren; i+=2)
+ {
+ // compute piece
+ double value = evaluateASTNode(node->getChild(i), m);
+ double boolean = evaluateASTNode(node->getChild(i+1), m);
+ if (boolean == 1.0)
+ {
+ result = boolean;
+ assigned = true;
+ }
+ }
+ if (!assigned)
+ {
+ // compute otherwise
+ result = numeric_limits<double>::quiet_NaN();
+ }
}
else
{
Modified: trunk/libsbml/src/sbml/test/TestSBMLTransforms.cpp
===================================================================
--- trunk/libsbml/src/sbml/test/TestSBMLTransforms.cpp 2012-01-31 01:47:11 UTC (rev 15336)
+++ trunk/libsbml/src/sbml/test/TestSBMLTransforms.cpp 2012-01-31 02:07:14 UTC (rev 15337)
@@ -467,6 +467,13 @@
fail_unless(isnan(SBMLTransforms::evaluateASTNode(node)));
+ node= SBML_parseFormula("piecewise(1,false)");
+ fail_unless(isnan(SBMLTransforms::evaluateASTNode(node)));
+
+ node= SBML_parseFormula("piecewise(1,true)");
+ fail_unless(equalDouble(SBMLTransforms::evaluateASTNode(node), 1));
+
+
node = SBML_parseFormula("root(2, 4)");
fail_unless(equalDouble(SBMLTransforms::evaluateASTNode(node), 2));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fbe...@us...> - 2012-01-31 01:47:17
|
Revision: 15336
http://sbml.svn.sourceforge.net/sbml/?rev=15336&view=rev
Author: fbergmann
Date: 2012-01-31 01:47:11 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
- add test for one argument in and, or, xor
Modified Paths:
--------------
trunk/libsbml/src/sbml/test/TestSBMLConvertStrict.c
Modified: trunk/libsbml/src/sbml/test/TestSBMLConvertStrict.c
===================================================================
--- trunk/libsbml/src/sbml/test/TestSBMLConvertStrict.c 2012-01-31 01:43:32 UTC (rev 15335)
+++ trunk/libsbml/src/sbml/test/TestSBMLConvertStrict.c 2012-01-31 01:47:11 UTC (rev 15336)
@@ -861,6 +861,19 @@
Parameter_setId(p3, "p3");
Parameter_setConstant(p3, 1);
+ Parameter_t * p4 = Model_createParameter(m);
+ Parameter_setId(p4, "p4");
+ Parameter_setConstant(p4, 1);
+
+ Parameter_t * p5 = Model_createParameter(m);
+ Parameter_setId(p5, "p5");
+ Parameter_setConstant(p5, 1);
+
+ Parameter_t * p6 = Model_createParameter(m);
+ Parameter_setId(p6, "p6");
+ Parameter_setConstant(p6, 1);
+
+
/* create initialAssignments */
InitialAssignment_t *ia1 = Model_createInitialAssignment(m);
InitialAssignment_setSymbol(ia1, "p1");
@@ -877,9 +890,23 @@
ASTNode_t *math2 = SBML_parseFormula("piecewise(1, xor(), 0)");
InitialAssignment_setMath(ia3, math2);
+ InitialAssignment_t *ia4 = Model_createInitialAssignment(m);
+ InitialAssignment_setSymbol(ia4, "p4");
+ ASTNode_t *math3 = SBML_parseFormula("piecewise(1, and(true), 0)");
+ InitialAssignment_setMath(ia4, math3);
- fail_unless (Model_getNumInitialAssignments(m) == 3);
+ InitialAssignment_t *ia5 = Model_createInitialAssignment(m);
+ InitialAssignment_setSymbol(ia5, "p5");
+ ASTNode_t *math4 = SBML_parseFormula("piecewise(1, or(false), 0)");
+ InitialAssignment_setMath(ia5, math4);
+ InitialAssignment_t *ia6 = Model_createInitialAssignment(m);
+ InitialAssignment_setSymbol(ia6, "p6");
+ ASTNode_t *math5 = SBML_parseFormula("piecewise(1, xor(true), 0)");
+ InitialAssignment_setMath(ia6, math5);
+
+ fail_unless (Model_getNumInitialAssignments(m) == 6);
+
fail_unless( SBMLDocument_setLevelAndVersionStrict(d, 2, 1) == 1 );
fail_unless( SBMLDocument_getLevel (d) == 2, NULL );
fail_unless( SBMLDocument_getVersion(d) == 1, NULL );
@@ -892,6 +919,9 @@
fail_unless (Parameter_getValue(Model_getParameter(m1, 1)) == 0);
fail_unless (Parameter_isSetValue(Model_getParameter(m1, 2)) == 1);
fail_unless (Parameter_getValue(Model_getParameter(m1, 2)) == 0);
+ fail_unless (Parameter_getValue(Model_getParameter(m1, 3)) == 1);
+ fail_unless (Parameter_getValue(Model_getParameter(m1, 4)) == 0);
+ fail_unless (Parameter_getValue(Model_getParameter(m1, 5)) == 1);
SBMLDocument_free(d);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fbe...@us...> - 2012-01-31 01:43:38
|
Revision: 15335
http://sbml.svn.sourceforge.net/sbml/?rev=15335&view=rev
Author: fbergmann
Date: 2012-01-31 01:43:32 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
- removed unsigned / signed warning
Modified Paths:
--------------
trunk/libsbml/src/sbml/SBMLTransforms.cpp
Modified: trunk/libsbml/src/sbml/SBMLTransforms.cpp
===================================================================
--- trunk/libsbml/src/sbml/SBMLTransforms.cpp 2012-01-31 01:42:22 UTC (rev 15334)
+++ trunk/libsbml/src/sbml/SBMLTransforms.cpp 2012-01-31 01:43:32 UTC (rev 15335)
@@ -726,7 +726,7 @@
else
{
bool assigned = false;
- for (int i = 0; i < numChildren-1; i+=2)
+ for (unsigned int i = 0; i < numChildren-1; i+=2)
{
// compute piece
double value = evaluateASTNode(node->getChild(i), m);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fbe...@us...> - 2012-01-31 01:42:29
|
Revision: 15334
http://sbml.svn.sourceforge.net/sbml/?rev=15334&view=rev
Author: fbergmann
Date: 2012-01-31 01:42:22 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
- missed case for one arg
Modified Paths:
--------------
trunk/libsbml/src/sbml/SBMLTransforms.cpp
Modified: trunk/libsbml/src/sbml/SBMLTransforms.cpp
===================================================================
--- trunk/libsbml/src/sbml/SBMLTransforms.cpp 2012-01-31 01:32:07 UTC (rev 15333)
+++ trunk/libsbml/src/sbml/SBMLTransforms.cpp 2012-01-31 01:42:22 UTC (rev 15334)
@@ -781,6 +781,8 @@
{
if (node->getNumChildren() == 0)
result = 1.0;
+ else if (node->getNumChildren() == 1)
+ result = evaluateASTNode(node->getChild(0), m);
else
result = (double) ((evaluateASTNode(node->getChild(0), m))
&& (evaluateASTNode(node->getChild(1), m)));
@@ -795,6 +797,8 @@
{
if (node->getNumChildren() == 0)
result = 0.0;
+ else if (node->getNumChildren() == 1)
+ result = evaluateASTNode(node->getChild(0), m);
else
result = (double) ((evaluateASTNode(node->getChild(0), m))
|| (evaluateASTNode(node->getChild(1), m)));
@@ -805,6 +809,8 @@
{
if (node->getNumChildren() == 0)
result = 0.0;
+ else if (node->getNumChildren() == 1)
+ result = evaluateASTNode(node->getChild(0), m);
else
result = (double) ((!(evaluateASTNode(node->getChild(0), m))
&& (evaluateASTNode(node->getChild(1), m)))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fbe...@us...> - 2012-01-31 01:32:14
|
Revision: 15333
http://sbml.svn.sourceforge.net/sbml/?rev=15333&view=rev
Author: fbergmann
Date: 2012-01-31 01:32:07 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
- corrected n-ary test, now it correctly tests that the divide function is binary, and that times accepts any number of arguments
Modified Paths:
--------------
trunk/libsbml/src/sbml/math/test/TestValidASTNode.cpp
Modified: trunk/libsbml/src/sbml/math/test/TestValidASTNode.cpp
===================================================================
--- trunk/libsbml/src/sbml/math/test/TestValidASTNode.cpp 2012-01-31 01:26:48 UTC (rev 15332)
+++ trunk/libsbml/src/sbml/math/test/TestValidASTNode.cpp 2012-01-31 01:32:07 UTC (rev 15333)
@@ -221,17 +221,27 @@
START_TEST (test_ValidASTNode_nary)
{
- ASTNode *n = new ASTNode(AST_TIMES);
- fail_unless( (n->isWellFormedASTNode()) );
+ ASTNode *n = new ASTNode(AST_DIVIDE);
+ fail_unless( !(n->isWellFormedASTNode()) );
+
+ ASTNode *c = SBML_parseFormula("c");
- n = new ASTNode(AST_DIVIDE);
+ n->addChild(c);
fail_unless( !(n->isWellFormedASTNode()) );
- ASTNode *c = SBML_parseFormula("c");
n->addChild(c);
+ fail_unless( (n->isWellFormedASTNode()) );
+ n->addChild(c);
fail_unless( !(n->isWellFormedASTNode()) );
+ n = new ASTNode(AST_TIMES);
+ fail_unless( (n->isWellFormedASTNode()) );
+
+ n->addChild(c);
+
+ fail_unless( (n->isWellFormedASTNode()) );
+
ASTNode *d = SBML_parseFormula("d");
n->addChild(d);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fbe...@us...> - 2012-01-31 01:26:54
|
Revision: 15332
http://sbml.svn.sourceforge.net/sbml/?rev=15332&view=rev
Author: fbergmann
Date: 2012-01-31 01:26:48 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
- AST_TIMES is indeed an n-ary expression and is valid!, added AST_DIVIDE as invalid
Modified Paths:
--------------
trunk/libsbml/src/sbml/math/test/TestValidASTNode.cpp
Modified: trunk/libsbml/src/sbml/math/test/TestValidASTNode.cpp
===================================================================
--- trunk/libsbml/src/sbml/math/test/TestValidASTNode.cpp 2012-01-31 01:16:54 UTC (rev 15331)
+++ trunk/libsbml/src/sbml/math/test/TestValidASTNode.cpp 2012-01-31 01:26:48 UTC (rev 15332)
@@ -222,7 +222,9 @@
START_TEST (test_ValidASTNode_nary)
{
ASTNode *n = new ASTNode(AST_TIMES);
+ fail_unless( (n->isWellFormedASTNode()) );
+ n = new ASTNode(AST_DIVIDE);
fail_unless( !(n->isWellFormedASTNode()) );
ASTNode *c = SBML_parseFormula("c");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fbe...@us...> - 2012-01-31 01:17:00
|
Revision: 15331
http://sbml.svn.sourceforge.net/sbml/?rev=15331&view=rev
Author: fbergmann
Date: 2012-01-31 01:16:54 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
- implemented piecewise evaluation and added tests
- modified ASTNode::hasCorrectNumberArguments to return true for the n-ary functions and, or, plus, times, xor
- modified tests that assumed that AST_TIMES is an invalid node, these tests use instead AST_DIVIDE (which is binary)
Modified Paths:
--------------
trunk/libsbml/src/sbml/SBMLTransforms.cpp
trunk/libsbml/src/sbml/math/ASTNode.cpp
trunk/libsbml/src/sbml/test/TestConstraint_newSetters.c
trunk/libsbml/src/sbml/test/TestDelay.c
trunk/libsbml/src/sbml/test/TestEventAssignment_newSetters.c
trunk/libsbml/src/sbml/test/TestFunctionDefinition_newSetters.c
trunk/libsbml/src/sbml/test/TestInitialAssignment_newSetters.c
trunk/libsbml/src/sbml/test/TestKineticLaw_newSetters.c
trunk/libsbml/src/sbml/test/TestPriority.c
trunk/libsbml/src/sbml/test/TestRule_newSetters.c
trunk/libsbml/src/sbml/test/TestSBMLConvertStrict.c
trunk/libsbml/src/sbml/test/TestSBMLTransforms.cpp
trunk/libsbml/src/sbml/test/TestStoichiometryMath.c
trunk/libsbml/src/sbml/test/TestTrigger.c
Modified: trunk/libsbml/src/sbml/SBMLTransforms.cpp
===================================================================
--- trunk/libsbml/src/sbml/SBMLTransforms.cpp 2012-01-30 21:59:03 UTC (rev 15330)
+++ trunk/libsbml/src/sbml/SBMLTransforms.cpp 2012-01-31 01:16:54 UTC (rev 15331)
@@ -715,9 +715,35 @@
result = log10(evaluateASTNode(node->getChild(1), m));
break;
- case AST_FUNCTION_PIECEWISE:
- /* cannot do this */
- result = numeric_limits<double>::quiet_NaN();
+ case AST_FUNCTION_PIECEWISE:
+ {
+ unsigned int numChildren = node->getNumChildren();
+ if ( numChildren == 0 || numChildren == 2)
+ {
+ /* cannot do this */
+ result = numeric_limits<double>::quiet_NaN();
+ }
+ else
+ {
+ bool assigned = false;
+ for (int i = 0; i < numChildren-1; i+=2)
+ {
+ // compute piece
+ double value = evaluateASTNode(node->getChild(i), m);
+ double boolean = evaluateASTNode(node->getChild(i+1), m);
+ if (boolean == 1.0)
+ {
+ result = boolean;
+ assigned = true;
+ }
+ }
+ if (!assigned)
+ {
+ // compute otherwise
+ result = evaluateASTNode(node->getChild(numChildren-1), m);
+ }
+ }
+ }
break;
case AST_FUNCTION_ROOT:
Modified: trunk/libsbml/src/sbml/math/ASTNode.cpp
===================================================================
--- trunk/libsbml/src/sbml/math/ASTNode.cpp 2012-01-30 21:59:03 UTC (rev 15330)
+++ trunk/libsbml/src/sbml/math/ASTNode.cpp 2012-01-31 01:16:54 UTC (rev 15331)
@@ -2161,6 +2161,9 @@
case AST_LOGICAL_AND:
case AST_LOGICAL_OR:
case AST_LOGICAL_XOR:
+ correctNum = true;
+ break;
+
case AST_RELATIONAL_EQ:
case AST_RELATIONAL_GEQ:
case AST_RELATIONAL_GT:
Modified: trunk/libsbml/src/sbml/test/TestConstraint_newSetters.c
===================================================================
--- trunk/libsbml/src/sbml/test/TestConstraint_newSetters.c 2012-01-30 21:59:03 UTC (rev 15330)
+++ trunk/libsbml/src/sbml/test/TestConstraint_newSetters.c 2012-01-31 01:16:54 UTC (rev 15331)
@@ -89,7 +89,7 @@
START_TEST (test_Constraint_setMath2)
{
- ASTNode_t *math = ASTNode_createWithType(AST_TIMES);
+ ASTNode_t *math = ASTNode_createWithType(AST_DIVIDE);
int i = Constraint_setMath(C, math);
Modified: trunk/libsbml/src/sbml/test/TestDelay.c
===================================================================
--- trunk/libsbml/src/sbml/test/TestDelay.c 2012-01-30 21:59:03 UTC (rev 15330)
+++ trunk/libsbml/src/sbml/test/TestDelay.c 2012-01-31 01:16:54 UTC (rev 15331)
@@ -173,7 +173,7 @@
START_TEST (test_Delay_setMath2)
{
- ASTNode_t *math = ASTNode_createWithType(AST_TIMES);
+ ASTNode_t *math = ASTNode_createWithType(AST_DIVIDE);
int i = Delay_setMath(D, math);
Modified: trunk/libsbml/src/sbml/test/TestEventAssignment_newSetters.c
===================================================================
--- trunk/libsbml/src/sbml/test/TestEventAssignment_newSetters.c 2012-01-30 21:59:03 UTC (rev 15330)
+++ trunk/libsbml/src/sbml/test/TestEventAssignment_newSetters.c 2012-01-31 01:16:54 UTC (rev 15331)
@@ -118,7 +118,7 @@
START_TEST (test_EventAssignment_setMath2)
{
- ASTNode_t *math = ASTNode_createWithType(AST_TIMES);
+ ASTNode_t *math = ASTNode_createWithType(AST_DIVIDE);
int i = EventAssignment_setMath(E, math);
Modified: trunk/libsbml/src/sbml/test/TestFunctionDefinition_newSetters.c
===================================================================
--- trunk/libsbml/src/sbml/test/TestFunctionDefinition_newSetters.c 2012-01-30 21:59:03 UTC (rev 15330)
+++ trunk/libsbml/src/sbml/test/TestFunctionDefinition_newSetters.c 2012-01-31 01:16:54 UTC (rev 15331)
@@ -156,7 +156,7 @@
START_TEST (test_FunctionDefinition_setMath2)
{
- ASTNode_t *math = ASTNode_createWithType(AST_TIMES);
+ ASTNode_t *math = ASTNode_createWithType(AST_DIVIDE);
int i = FunctionDefinition_setMath(E, math);
Modified: trunk/libsbml/src/sbml/test/TestInitialAssignment_newSetters.c
===================================================================
--- trunk/libsbml/src/sbml/test/TestInitialAssignment_newSetters.c 2012-01-30 21:59:03 UTC (rev 15330)
+++ trunk/libsbml/src/sbml/test/TestInitialAssignment_newSetters.c 2012-01-31 01:16:54 UTC (rev 15331)
@@ -118,7 +118,7 @@
START_TEST (test_InitialAssignment_setMath2)
{
- ASTNode_t *math = ASTNode_createWithType(AST_TIMES);
+ ASTNode_t *math = ASTNode_createWithType(AST_DIVIDE);
int i = InitialAssignment_setMath(E, math);
Modified: trunk/libsbml/src/sbml/test/TestKineticLaw_newSetters.c
===================================================================
--- trunk/libsbml/src/sbml/test/TestKineticLaw_newSetters.c 2012-01-30 21:59:03 UTC (rev 15330)
+++ trunk/libsbml/src/sbml/test/TestKineticLaw_newSetters.c 2012-01-31 01:16:54 UTC (rev 15331)
@@ -133,7 +133,7 @@
START_TEST (test_KineticLaw_setMath2)
{
- ASTNode_t *math = ASTNode_createWithType(AST_TIMES);
+ ASTNode_t *math = ASTNode_createWithType(AST_DIVIDE);
ASTNode_t *a = ASTNode_create();
ASTNode_setName(a, "a");
ASTNode_addChild(math, a);
Modified: trunk/libsbml/src/sbml/test/TestPriority.c
===================================================================
--- trunk/libsbml/src/sbml/test/TestPriority.c 2012-01-30 21:59:03 UTC (rev 15330)
+++ trunk/libsbml/src/sbml/test/TestPriority.c 2012-01-31 01:16:54 UTC (rev 15331)
@@ -142,7 +142,7 @@
START_TEST (test_Priority_setMath2)
{
- ASTNode_t *math = ASTNode_createWithType(AST_TIMES);
+ ASTNode_t *math = ASTNode_createWithType(AST_DIVIDE);
int i = Priority_setMath(P, math);
Modified: trunk/libsbml/src/sbml/test/TestRule_newSetters.c
===================================================================
--- trunk/libsbml/src/sbml/test/TestRule_newSetters.c 2012-01-30 21:59:03 UTC (rev 15330)
+++ trunk/libsbml/src/sbml/test/TestRule_newSetters.c 2012-01-31 01:16:54 UTC (rev 15331)
@@ -133,7 +133,7 @@
START_TEST (test_Rule_setMath2)
{
- ASTNode_t *math = ASTNode_createWithType(AST_TIMES);
+ ASTNode_t *math = ASTNode_createWithType(AST_DIVIDE);
ASTNode_t *a = ASTNode_create();
ASTNode_setName(a, "a");
ASTNode_addChild(math, a);
Modified: trunk/libsbml/src/sbml/test/TestSBMLConvertStrict.c
===================================================================
--- trunk/libsbml/src/sbml/test/TestSBMLConvertStrict.c 2012-01-30 21:59:03 UTC (rev 15330)
+++ trunk/libsbml/src/sbml/test/TestSBMLConvertStrict.c 2012-01-31 01:16:54 UTC (rev 15331)
@@ -841,7 +841,63 @@
}
END_TEST
+START_TEST (test_SBMLConvertStrict_convertInitialAssignmentsToL2)
+{
+ SBMLDocument_t *d = SBMLDocument_createWithLevelAndVersion(3, 1);
+
+ /* create model */
+ Model_t * m = SBMLDocument_createModel(d);
+
+ /* create three parameters*/
+ Parameter_t * p1 = Model_createParameter(m);
+ Parameter_setId(p1, "p1");
+ Parameter_setConstant(p1, 1);
+ Parameter_setValue(p1, 1);
+ Parameter_t * p2 = Model_createParameter(m);
+ Parameter_setId(p2, "p2");
+ Parameter_setConstant(p2, 1);
+ Parameter_setValue(p2, 4.6);
+ Parameter_t * p3 = Model_createParameter(m);
+ Parameter_setId(p3, "p3");
+ Parameter_setConstant(p3, 1);
+ /* create initialAssignments */
+ InitialAssignment_t *ia1 = Model_createInitialAssignment(m);
+ InitialAssignment_setSymbol(ia1, "p1");
+ ASTNode_t *math = SBML_parseFormula("piecewise(1, and(), 0)");
+ InitialAssignment_setMath(ia1, math);
+
+ InitialAssignment_t *ia2 = Model_createInitialAssignment(m);
+ InitialAssignment_setSymbol(ia2, "p2");
+ ASTNode_t *math1 = SBML_parseFormula("piecewise(1, or(), 0)");
+ InitialAssignment_setMath(ia2, math1);
+
+ InitialAssignment_t *ia3 = Model_createInitialAssignment(m);
+ InitialAssignment_setSymbol(ia3, "p3");
+ ASTNode_t *math2 = SBML_parseFormula("piecewise(1, xor(), 0)");
+ InitialAssignment_setMath(ia3, math2);
+
+
+ fail_unless (Model_getNumInitialAssignments(m) == 3);
+
+ fail_unless( SBMLDocument_setLevelAndVersionStrict(d, 2, 1) == 1 );
+ fail_unless( SBMLDocument_getLevel (d) == 2, NULL );
+ fail_unless( SBMLDocument_getVersion(d) == 1, NULL );
+
+ Model_t * m1 = SBMLDocument_getModel(d);
+
+ fail_unless (Model_getNumInitialAssignments(m1) == 0);
+
+ fail_unless (Parameter_getValue(Model_getParameter(m1, 0)) == 1);
+ fail_unless (Parameter_getValue(Model_getParameter(m1, 1)) == 0);
+ fail_unless (Parameter_isSetValue(Model_getParameter(m1, 2)) == 1);
+ fail_unless (Parameter_getValue(Model_getParameter(m1, 2)) == 0);
+
+ SBMLDocument_free(d);
+}
+END_TEST
+
+
START_TEST (test_SBMLConvertStrict_convertInitialAssignmentsToL1)
{
SBMLDocument_t *d = SBMLDocument_createWithLevelAndVersion(2, 2);
@@ -932,6 +988,7 @@
tcase_add_test( tcase, test_SBMLConvertStrict_convertFromL3_spatialDim5 );
tcase_add_test( tcase, test_SBMLConvertStrict_convertFuncDefsToL1 );
tcase_add_test( tcase, test_SBMLConvertStrict_convertInitialAssignmentsToL1 );
+ tcase_add_test( tcase, test_SBMLConvertStrict_convertInitialAssignmentsToL2 );
suite_add_tcase(suite, tcase);
return suite;
Modified: trunk/libsbml/src/sbml/test/TestSBMLTransforms.cpp
===================================================================
--- trunk/libsbml/src/sbml/test/TestSBMLTransforms.cpp 2012-01-30 21:59:03 UTC (rev 15330)
+++ trunk/libsbml/src/sbml/test/TestSBMLTransforms.cpp 2012-01-31 01:16:54 UTC (rev 15331)
@@ -424,6 +424,14 @@
temp = 0.5 * log(3.0);
fail_unless(equalDouble(SBMLTransforms::evaluateASTNode(node), temp));
+ node = SBML_parseFormula("piecewise(1.0, true, 0.0)");
+ temp = 1.0;
+ fail_unless(equalDouble(SBMLTransforms::evaluateASTNode(node), temp));
+
+ node = SBML_parseFormula("piecewise(1.0, false, 0.0)");
+ temp = 0.0;
+ fail_unless(equalDouble(SBMLTransforms::evaluateASTNode(node), temp));
+
node = SBML_parseFormula("arcsech(0.2)");
temp = log(2*pow(6, 0.5)+5);
@@ -455,7 +463,7 @@
fail_unless(equalDouble(SBMLTransforms::evaluateASTNode(node), 6));
- node->setType(AST_FUNCTION_PIECEWISE);
+ node= SBML_parseFormula("piecewise()");
fail_unless(isnan(SBMLTransforms::evaluateASTNode(node)));
Modified: trunk/libsbml/src/sbml/test/TestStoichiometryMath.c
===================================================================
--- trunk/libsbml/src/sbml/test/TestStoichiometryMath.c 2012-01-30 21:59:03 UTC (rev 15330)
+++ trunk/libsbml/src/sbml/test/TestStoichiometryMath.c 2012-01-31 01:16:54 UTC (rev 15331)
@@ -173,7 +173,7 @@
START_TEST (test_StoichiometryMath_setMath2)
{
- ASTNode_t *math = ASTNode_createWithType(AST_TIMES);
+ ASTNode_t *math = ASTNode_createWithType(AST_DIVIDE);
int i = StoichiometryMath_setMath(D, math);
Modified: trunk/libsbml/src/sbml/test/TestTrigger.c
===================================================================
--- trunk/libsbml/src/sbml/test/TestTrigger.c 2012-01-30 21:59:03 UTC (rev 15330)
+++ trunk/libsbml/src/sbml/test/TestTrigger.c 2012-01-31 01:16:54 UTC (rev 15331)
@@ -171,7 +171,7 @@
START_TEST (test_Trigger_setMath2)
{
- ASTNode_t *math = ASTNode_createWithType(AST_TIMES);
+ ASTNode_t *math = ASTNode_createWithType(AST_DIVIDE);
int i = Trigger_setMath(D, math);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fbe...@us...> - 2012-01-30 21:59:10
|
Revision: 15330
http://sbml.svn.sourceforge.net/sbml/?rev=15330&view=rev
Author: fbergmann
Date: 2012-01-30 21:59:03 +0000 (Mon, 30 Jan 2012)
Log Message:
-----------
- fix evaluation of and(), or() and xor() with zero args
Modified Paths:
--------------
trunk/libsbml/src/sbml/SBMLTransforms.cpp
Modified: trunk/libsbml/src/sbml/SBMLTransforms.cpp
===================================================================
--- trunk/libsbml/src/sbml/SBMLTransforms.cpp 2012-01-29 21:15:04 UTC (rev 15329)
+++ trunk/libsbml/src/sbml/SBMLTransforms.cpp 2012-01-30 21:59:03 UTC (rev 15330)
@@ -752,8 +752,13 @@
break;
case AST_LOGICAL_AND:
- result = (double) ((evaluateASTNode(node->getChild(0), m))
- && (evaluateASTNode(node->getChild(1), m)));
+ {
+ if (node->getNumChildren() == 0)
+ result = 1.0;
+ else
+ result = (double) ((evaluateASTNode(node->getChild(0), m))
+ && (evaluateASTNode(node->getChild(1), m)));
+ }
break;
case AST_LOGICAL_NOT:
@@ -761,15 +766,25 @@
break;
case AST_LOGICAL_OR:
- result = (double) ((evaluateASTNode(node->getChild(0), m))
- || (evaluateASTNode(node->getChild(1), m)));
+ {
+ if (node->getNumChildren() == 0)
+ result = 0.0;
+ else
+ result = (double) ((evaluateASTNode(node->getChild(0), m))
+ || (evaluateASTNode(node->getChild(1), m)));
+ }
break;
case AST_LOGICAL_XOR:
- result = (double) ((!(evaluateASTNode(node->getChild(0), m))
+ {
+ if (node->getNumChildren() == 0)
+ result = 0.0;
+ else
+ result = (double) ((!(evaluateASTNode(node->getChild(0), m))
&& (evaluateASTNode(node->getChild(1), m)))
- || ((evaluateASTNode(node->getChild(0), m))
+ || ((evaluateASTNode(node->getChild(0), m))
&& !(evaluateASTNode(node->getChild(1), m))));
+ }
break;
case AST_RELATIONAL_EQ :
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fbe...@us...> - 2012-01-29 21:15:11
|
Revision: 15329
http://sbml.svn.sourceforge.net/sbml/?rev=15329&view=rev
Author: fbergmann
Date: 2012-01-29 21:15:04 +0000 (Sun, 29 Jan 2012)
Log Message:
-----------
- caught typo in url
Modified Paths:
--------------
trunk/libsbml/src/sbml/SBase.h
trunk/libsbml/src/sbml/extension/SBasePlugin.h
Modified: trunk/libsbml/src/sbml/SBase.h
===================================================================
--- trunk/libsbml/src/sbml/SBase.h 2012-01-27 22:58:04 UTC (rev 15328)
+++ trunk/libsbml/src/sbml/SBase.h 2012-01-29 21:15:04 UTC (rev 15329)
@@ -942,7 +942,7 @@
* time, libSBML supports the use of <a target="_blank"
* href="http://xmlsoft.org">libxml2</a>, <a target="_blank"
* href="http://expat.sourceforge.net/">Expat</a> and <a target="_blank"
- * href="http://http://xerces.apache.org/xerces-c/">Xerces</a>.)
+ * href="http://xerces.apache.org/xerces-c/">Xerces</a>.)
*
* @see getColumn()
*/
@@ -968,7 +968,7 @@
* time, libSBML supports the use of <a target="_blank"
* href="http://xmlsoft.org">libxml2</a>, <a target="_blank"
* href="http://expat.sourceforge.net/">Expat</a> and <a target="_blank"
- * href="http://http://xerces.apache.org/xerces-c/">Xerces</a>.)
+ * href="http://xerces.apache.org/xerces-c/">Xerces</a>.)
*
* @see getLine()
*/
Modified: trunk/libsbml/src/sbml/extension/SBasePlugin.h
===================================================================
--- trunk/libsbml/src/sbml/extension/SBasePlugin.h 2012-01-27 22:58:04 UTC (rev 15328)
+++ trunk/libsbml/src/sbml/extension/SBasePlugin.h 2012-01-29 21:15:04 UTC (rev 15329)
@@ -657,7 +657,7 @@
* time, libSBML supports the use of <a target="_blank"
* href="http://xmlsoft.org">libxml2</a>, <a target="_blank"
* href="http://expat.sourceforge.net/">Expat</a> and <a target="_blank"
- * href="http://http://xerces.apache.org/xerces-c/">Xerces</a>.)
+ * href="http://xerces.apache.org/xerces-c/">Xerces</a>.)
*
* @see getColumn()
*/
@@ -684,7 +684,7 @@
* time, libSBML supports the use of <a target="_blank"
* href="http://xmlsoft.org">libxml2</a>, <a target="_blank"
* href="http://expat.sourceforge.net/">Expat</a> and <a target="_blank"
- * href="http://http://xerces.apache.org/xerces-c/">Xerces</a>.)
+ * href="http://xerces.apache.org/xerces-c/">Xerces</a>.)
*
* @see getLine()
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mh...@us...> - 2012-01-27 22:58:10
|
Revision: 15328
http://sbml.svn.sourceforge.net/sbml/?rev=15328&view=rev
Author: mhucka
Date: 2012-01-27 22:58:04 +0000 (Fri, 27 Jan 2012)
Log Message:
-----------
Updated copyright year.
Modified Paths:
--------------
trunk/project/tex/sbmlpkgspec/LICENSE.html
trunk/project/tex/sbmlpkgspec/LICENSE.txt
trunk/project/tex/sbmlpkgspec/NEWS.txt
Modified: trunk/project/tex/sbmlpkgspec/LICENSE.html
===================================================================
--- trunk/project/tex/sbmlpkgspec/LICENSE.html 2012-01-27 22:57:52 UTC (rev 15327)
+++ trunk/project/tex/sbmlpkgspec/LICENSE.html 2012-01-27 22:58:04 UTC (rev 15328)
@@ -5,7 +5,7 @@
generation system code in ./docs/src/ .
-->
-Copyright © 2009-2011 jointly by the following organizations:<br>
+Copyright © 2009-2012 jointly by the following organizations:<br>
1. California Institute of Technology, Pasadena, CA, USA<br>
2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK<br>
<p>
Modified: trunk/project/tex/sbmlpkgspec/LICENSE.txt
===================================================================
--- trunk/project/tex/sbmlpkgspec/LICENSE.txt 2012-01-27 22:57:52 UTC (rev 15327)
+++ trunk/project/tex/sbmlpkgspec/LICENSE.txt 2012-01-27 22:58:04 UTC (rev 15328)
@@ -1,6 +1,6 @@
Licensing and Distribution Terms for libSBML
-Copyright (C) 2009-2011 jointly by the following organizations:
+Copyright (C) 2009-2012 jointly by the following organizations:
1. California Institute of Technology, Pasadena, CA, USA
2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK
Modified: trunk/project/tex/sbmlpkgspec/NEWS.txt
===================================================================
--- trunk/project/tex/sbmlpkgspec/NEWS.txt 2012-01-27 22:57:52 UTC (rev 15327)
+++ trunk/project/tex/sbmlpkgspec/NEWS.txt 2012-01-27 22:58:04 UTC (rev 15328)
@@ -5,6 +5,7 @@
* Added amsmath as a package loaded by default.
* Fixed vertical heights of \big delimiters in math mode.
* Rewrote \validRule and friends to not require an \sbmlenum environment.
+* Updated copyright year.
=============================================================================
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mh...@us...> - 2012-01-27 22:57:59
|
Revision: 15327
http://sbml.svn.sourceforge.net/sbml/?rev=15327&view=rev
Author: mhucka
Date: 2012-01-27 22:57:52 +0000 (Fri, 27 Jan 2012)
Log Message:
-----------
Updated file release date and copyright year.
Modified Paths:
--------------
trunk/project/tex/sbmlpkgspec/sbmlpkgspec.cls
Modified: trunk/project/tex/sbmlpkgspec/sbmlpkgspec.cls
===================================================================
--- trunk/project/tex/sbmlpkgspec/sbmlpkgspec.cls 2012-01-27 22:53:39 UTC (rev 15326)
+++ trunk/project/tex/sbmlpkgspec/sbmlpkgspec.cls 2012-01-27 22:57:52 UTC (rev 15327)
@@ -6,7 +6,7 @@
%% Date created: 2011-08-11
%% Home page: http://sbml.org/Documents/Specifications/LaTeX
%%
-%% Copyright 2007-2011 California Institute of Technology, Pasadena, CA, USA.
+%% Copyright 2007-2012 California Institute of Technology, Pasadena, CA, USA.
%%
%% This file is free software; you can redistribute it and/or modify it
%% under the terms of the GNU Lesser General Public License as published
@@ -34,7 +34,7 @@
%% It would be so nice to be able to put the CVS/RCS 'Date' tag in the
%% \filedate below. Unfortunately, LaTeX will barf on the resulting string.
-\def\filedate{2011/10/20}
+\def\filedate{2012/01/27}
\NeedsTeXFormat{LaTeX2e}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mh...@us...> - 2012-01-27 22:53:45
|
Revision: 15326
http://sbml.svn.sourceforge.net/sbml/?rev=15326&view=rev
Author: mhucka
Date: 2012-01-27 22:53:39 +0000 (Fri, 27 Jan 2012)
Log Message:
-----------
Almost forgot to mention another change in 1.2.0.
Modified Paths:
--------------
trunk/project/tex/sbmlpkgspec/NEWS.txt
Modified: trunk/project/tex/sbmlpkgspec/NEWS.txt
===================================================================
--- trunk/project/tex/sbmlpkgspec/NEWS.txt 2012-01-27 22:44:04 UTC (rev 15325)
+++ trunk/project/tex/sbmlpkgspec/NEWS.txt 2012-01-27 22:53:39 UTC (rev 15326)
@@ -4,6 +4,7 @@
* Added amsmath as a package loaded by default.
* Fixed vertical heights of \big delimiters in math mode.
+* Rewrote \validRule and friends to not require an \sbmlenum environment.
=============================================================================
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mh...@us...> - 2012-01-27 22:44:14
|
Revision: 15325
http://sbml.svn.sourceforge.net/sbml/?rev=15325&view=rev
Author: mhucka
Date: 2012-01-27 22:44:04 +0000 (Fri, 27 Jan 2012)
Log Message:
-----------
Updated documentation for 1.2.0.
Modified Paths:
--------------
trunk/project/tex/sbmlpkgspec/NEWS.txt
trunk/project/tex/sbmlpkgspec/sbmlpkgspec-doc.pdf
trunk/project/tex/sbmlpkgspec/sbmlpkgspec-doc.tex
Modified: trunk/project/tex/sbmlpkgspec/NEWS.txt
===================================================================
--- trunk/project/tex/sbmlpkgspec/NEWS.txt 2012-01-27 22:34:42 UTC (rev 15324)
+++ trunk/project/tex/sbmlpkgspec/NEWS.txt 2012-01-27 22:44:04 UTC (rev 15325)
@@ -1,4 +1,12 @@
=============================================================================
+News for version 1.2.0 (2012-01-27 <mh...@ca...>)
+=============================================================================
+
+* Added amsmath as a package loaded by default.
+* Fixed vertical heights of \big delimiters in math mode.
+
+
+=============================================================================
News for version 1.1.0 (2011-10-20 <mh...@ca...>)
=============================================================================
Modified: trunk/project/tex/sbmlpkgspec/sbmlpkgspec-doc.pdf
===================================================================
--- trunk/project/tex/sbmlpkgspec/sbmlpkgspec-doc.pdf 2012-01-27 22:34:42 UTC (rev 15324)
+++ trunk/project/tex/sbmlpkgspec/sbmlpkgspec-doc.pdf 2012-01-27 22:44:04 UTC (rev 15325)
@@ -1,21 +1,18 @@
%PDF-1.5
%\xD0\xD4\xC5\xD8
95 0 obj <<
-/Length 867
+/Length 864
/Filter /FlateDecode
>>
stream
-xڭVYoA~ﯘ\xC7Y\x895s\xCFO\xB4\xA5\x9C\xAD\xA0$ \xA4\xC2òٴII
-\xE2\xDFc{6G\xDB\xD0Tj\xB5ʬ\xC7\xC7\xE7\xB1\xC7vV\x811B\xAD\x96\xD9\xF9Ɔ\x97\x8F\xAF\xF6\x94@\xAE\xA07=\xA4\xC2I\xEEc\xFDH:\x9A\x9Dj
-hb |
|
From: <mh...@us...> - 2012-01-27 22:34:48
|
Revision: 15324
http://sbml.svn.sourceforge.net/sbml/?rev=15324&view=rev
Author: mhucka
Date: 2012-01-27 22:34:42 +0000 (Fri, 27 Jan 2012)
Log Message:
-----------
1) Added inclusion of amsmath, because people seem to use it.
2) Adjusted the height of delimiters in math formulas -- they were too short
before.
Modified Paths:
--------------
trunk/project/tex/sbmlpkgspec/sbmlpkgspec.cls
Modified: trunk/project/tex/sbmlpkgspec/sbmlpkgspec.cls
===================================================================
--- trunk/project/tex/sbmlpkgspec/sbmlpkgspec.cls 2012-01-27 19:03:24 UTC (rev 15323)
+++ trunk/project/tex/sbmlpkgspec/sbmlpkgspec.cls 2012-01-27 22:34:42 UTC (rev 15324)
@@ -82,6 +82,7 @@
\RequirePackage{calc}
\RequirePackage{fancyhdr}
\RequirePackage{fancybox}
+\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{wasysym}
\RequirePackage{enumitem}
@@ -260,6 +261,13 @@
}{}
+% Adjustments due to quirks of the combination of fourier and amsmath:
+
+% Make the \big( braces regular height (default is too short):
+\delimiterfactor=1000
+\delimitershortfall=1pt
+
+
%% ----------------------------------------------------------------------------
%% Main code.
%% ----------------------------------------------------------------------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fbe...@us...> - 2012-01-27 19:03:31
|
Revision: 15323
http://sbml.svn.sourceforge.net/sbml/?rev=15323&view=rev
Author: fbergmann
Date: 2012-01-27 19:03:24 +0000 (Fri, 27 Jan 2012)
Log Message:
-----------
- simplified includes to work with strict includes flag
Modified Paths:
--------------
trunk/libsbml/examples/layout/addLayout.cpp
trunk/libsbml/examples/layout/example3-L3.cpp
trunk/libsbml/examples/layout/example3.cpp
Modified: trunk/libsbml/examples/layout/addLayout.cpp
===================================================================
--- trunk/libsbml/examples/layout/addLayout.cpp 2012-01-26 20:36:16 UTC (rev 15322)
+++ trunk/libsbml/examples/layout/addLayout.cpp 2012-01-27 19:03:24 UTC (rev 15323)
@@ -9,29 +9,11 @@
#include <iostream>
#include <string>
-#include <sbml/SBMLDocument.h>
-#include <sbml/Model.h>
-#include <sbml/Compartment.h>
-#include <sbml/Species.h>
-#include <sbml/SpeciesReference.h>
-#include <sbml/Reaction.h>
-#include <sbml/packages/layout/sbml/Layout.h>
-#include <sbml/packages/layout/sbml/CompartmentGlyph.h>
-#include <sbml/packages/layout/sbml/SpeciesGlyph.h>
-#include <sbml/packages/layout/sbml/ReactionGlyph.h>
-#include <sbml/packages/layout/sbml/SpeciesReferenceGlyph.h>
-#include <sbml/packages/layout/sbml/SpeciesReferenceGlyph.h>
-#include <sbml/packages/layout/extension/LayoutExtension.h>
-#include <sbml/packages/layout/extension/LayoutModelPlugin.h>
-#include <sbml/packages/layout/sbml/Curve.h>
-#include <sbml/packages/layout/sbml/Dimensions.h>
-#include <sbml/packages/layout/sbml/BoundingBox.h>
-#include <sbml/packages/layout/sbml/Point.h>
-#include <sbml/packages/layout/sbml/LineSegment.h>
-#include <sbml/packages/layout/sbml/CubicBezier.h>
-#include <sbml/SBMLWriter.h>
+#include "sbml/SBMLTypes.h"
+#include "sbml/packages/layout/common/LayoutExtensionTypes.h"
+
using namespace std;
LIBSBML_CPP_NAMESPACE_USE
Modified: trunk/libsbml/examples/layout/example3-L3.cpp
===================================================================
--- trunk/libsbml/examples/layout/example3-L3.cpp 2012-01-26 20:36:16 UTC (rev 15322)
+++ trunk/libsbml/examples/layout/example3-L3.cpp 2012-01-27 19:03:24 UTC (rev 15323)
@@ -46,28 +46,9 @@
*/
-#include "sbml/SBMLDocument.h"
-#include "sbml/Model.h"
-#include "sbml/Compartment.h"
-#include "sbml/Species.h"
-#include "sbml/SpeciesReference.h"
-#include "sbml/Reaction.h"
-#include "sbml/packages/layout/sbml/Layout.h"
-#include "sbml/packages/layout/sbml/CompartmentGlyph.h"
-#include "sbml/packages/layout/sbml/SpeciesGlyph.h"
-#include "sbml/packages/layout/sbml/ReactionGlyph.h"
-#include "sbml/packages/layout/sbml/SpeciesReferenceGlyph.h"
-#include "sbml/packages/layout/sbml/Curve.h"
-#include "sbml/packages/layout/sbml/Dimensions.h"
-#include "sbml/packages/layout/sbml/BoundingBox.h"
-#include "sbml/packages/layout/sbml/Point.h"
-#include "sbml/packages/layout/sbml/LineSegment.h"
-#include "sbml/packages/layout/sbml/CubicBezier.h"
-#include "sbml/SBMLWriter.h"
+#include "sbml/SBMLTypes.h"
+#include "sbml/packages/layout/common/LayoutExtensionTypes.h"
-#include "sbml/packages/layout/extension/LayoutExtension.h"
-#include "sbml/packages/layout/extension/LayoutModelPlugin.h"
-
LIBSBML_CPP_NAMESPACE_USE
int main(int argc,char** argv){
Modified: trunk/libsbml/examples/layout/example3.cpp
===================================================================
--- trunk/libsbml/examples/layout/example3.cpp 2012-01-26 20:36:16 UTC (rev 15322)
+++ trunk/libsbml/examples/layout/example3.cpp 2012-01-27 19:03:24 UTC (rev 15323)
@@ -45,28 +45,11 @@
*/
-#include "sbml/SBMLDocument.h"
-#include "sbml/Model.h"
-#include "sbml/Compartment.h"
-#include "sbml/Species.h"
-#include "sbml/SpeciesReference.h"
-#include "sbml/Reaction.h"
-#include "sbml/packages/layout/sbml/Layout.h"
-#include "sbml/packages/layout/sbml/CompartmentGlyph.h"
-#include "sbml/packages/layout/sbml/SpeciesGlyph.h"
-#include "sbml/packages/layout/sbml/ReactionGlyph.h"
-#include "sbml/packages/layout/sbml/SpeciesReferenceGlyph.h"
-#include "sbml/packages/layout/sbml/Curve.h"
-#include "sbml/packages/layout/sbml/Dimensions.h"
-#include "sbml/packages/layout/sbml/BoundingBox.h"
-#include "sbml/packages/layout/sbml/Point.h"
-#include "sbml/packages/layout/sbml/LineSegment.h"
-#include "sbml/packages/layout/sbml/CubicBezier.h"
-#include "sbml/SBMLWriter.h"
-#include "sbml/packages/layout/extension/LayoutExtension.h"
-#include "sbml/packages/layout/extension/LayoutModelPlugin.h"
+#include "sbml/SBMLTypes.h"
+#include "sbml/packages/layout/common/LayoutExtensionTypes.h"
+
LIBSBML_CPP_NAMESPACE_USE
int main(int argc,char** argv){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fbe...@us...> - 2012-01-26 20:36:23
|
Revision: 15322
http://sbml.svn.sourceforge.net/sbml/?rev=15322&view=rev
Author: fbergmann
Date: 2012-01-26 20:36:16 +0000 (Thu, 26 Jan 2012)
Log Message:
-----------
- add the compare line numbers program to SVN in case we ever want to repeat that test
Added Paths:
-----------
trunk/libsbml/dev/utilities/comparelinenumbers/
trunk/libsbml/dev/utilities/comparelinenumbers/LibSBMLLineNumbers.cs
trunk/libsbml/dev/utilities/comparelinenumbers/README.txt
Added: trunk/libsbml/dev/utilities/comparelinenumbers/LibSBMLLineNumbers.cs
===================================================================
--- trunk/libsbml/dev/utilities/comparelinenumbers/LibSBMLLineNumbers.cs (rev 0)
+++ trunk/libsbml/dev/utilities/comparelinenumbers/LibSBMLLineNumbers.cs 2012-01-26 20:36:16 UTC (rev 15322)
@@ -0,0 +1,385 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using libsbmlcs;
+
+namespace LibSBMLLineNumbers
+{
+ class Program
+ {
+ public static TextWriter Writer { get; set; }
+
+ public static string XMLParser
+ {
+ get
+ {
+ try
+ {
+ // we really ought to have a better way to detect the parser!
+ var stream = new XMLInputStream("<sbml/>", false, "expat", null);
+ if (!stream.isError())
+ return "expat";
+ stream = new XMLInputStream("<sbml/>", false, "libxml", null);
+ if (!stream.isError())
+ return "libxml";
+ stream = new XMLInputStream("<sbml/>", false, "xerces", null);
+ if (!stream.isError())
+ return "xerces-c";
+
+ }
+ catch
+ {
+
+ }
+ return "unknown";
+ }
+ }
+ private static string GetLine(string sbml, long line)
+ {
+ var lines = sbml.Split('\n');
+ if (line-1 < lines.Length)
+ return lines[line - 1];
+ return "invalid line";
+ }
+ private static void PrintLineNumbers(int level, int version, SBMLDocument doc, string message)
+ {
+ //doc.checkInternalConsistency();
+ var sbml = libsbml.writeSBMLToString(doc);
+ var doc2 = libsbml.readSBMLFromString(sbml);
+ doc2.checkConsistency();
+ for (int i = 0; i < doc2.getNumErrors(); i++)
+ {
+ var current = doc2.getError(i);
+ if (current.getSeverity() == libsbml.LIBSBML_SEV_ERROR ||
+ current.getSeverity() == libsbml.LIBSBML_SEV_FATAL)
+ {
+ if (current.getErrorId() == 10103)
+ continue;
+
+ Writer.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}",
+ XMLParser,
+ level,
+ version,
+ message,
+ current.getLine(),
+ current.getColumn(),
+ current.getErrorId(),
+ current.getShortMessage(),
+ GetLine(sbml, current.getLine()));
+ }
+ }
+
+ //libsbml.writeSBMLToFile(doc, string.Format("{0}-l{1}v{2}.xml", message, level, version));
+
+ }
+ private static void TestCompartment(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var comp = model.createCompartment();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "Compartment");
+ }
+ private static void TestCompartmentType(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var comp = model.createCompartmentType();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "CompartmentType");
+ }
+ private static void TestSpecies(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var element = model.createSpecies();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "Species");
+ }
+ private static void TestSpeciesType(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var element = model.createSpeciesType();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "SpeciesType");
+ }
+ private static void TestFunctionDefinition(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var element = model.createFunctionDefinition();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "FunctionDefiniton");
+ }
+ private static void TestParameter(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var element = model.createParameter();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "Parameter");
+ }
+ private static void TestAlgebraicRule(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var element = model.createAlgebraicRule();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "AlgebraicRule");
+ }
+ private static void TestAssignmentRule(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var element = model.createAssignmentRule();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "AssignmentRule");
+ }
+ private static void TestRateRule(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var element = model.createRateRule();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "RateRule");
+ }
+ private static void TestReaction(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var element = model.createReaction();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "Reaction");
+ }
+ private static void TestKineticLaw(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var reaction= model.createReaction();
+
+ reaction.initDefaults();
+ reaction.createKineticLaw();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "KineticLaw");
+ }
+ private static void TestLocalParameter(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var reaction = model.createReaction();
+
+ reaction.initDefaults();
+ var law = reaction.createKineticLaw();
+ law.createParameter();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "LocalParameter");
+ }
+ private static void TestEvent(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var element = model.createEvent();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "Event");
+ }
+ private static void TestEventAssignment(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var element = model.createEvent();
+ if (element == null) return;
+ element.createEventAssignment();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "EventAssignment");
+ }
+ private static void TestTrigger(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var element = model.createEvent();
+ if (element == null) return;
+ element.createTrigger();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "Trigger");
+ }
+ private static void TestDelay(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var element = model.createEvent();
+ if (element == null) return;
+ element.createDelay();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "Delay");
+ }
+ private static void TestPriority(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var element = model.createEvent();
+ if (element == null) return;
+ element.createPriority();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "Priority");
+ }
+ private static void TestConstraint(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var element = model.createConstraint();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "Constraint");
+ }
+ private static void TestInitialAssignment(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var element = model.createInitialAssignment();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "InitialAssignment");
+ }
+ private static void TestSpeciesReference(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var reaction = model.createReaction();
+
+ reaction.initDefaults();
+ var sr = reaction.createReactant();
+
+
+ PrintLineNumbers(level,
+ version,
+ doc, "SpeciesReference");
+ }
+ private static void TestStoichiometryMath(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var reaction = model.createReaction();
+
+ reaction.initDefaults();
+ var sr = reaction.createReactant();
+ sr.createStoichiometryMath();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "StoichiometryMath");
+ }
+ private static void TestUnit(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var element = model.createUnitDefinition();
+ var element1 = model.createUnit();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "Unit");
+ }
+ private static void TestUnitDefinition(int level, int version)
+ {
+ var doc = new SBMLDocument(level, version);
+ var model = doc.createModel();
+ var element = model.createUnitDefinition();
+
+ PrintLineNumbers(level,
+ version,
+ doc, "UnitDefinition");
+ }
+ private static void TestSBMLLevelVersion(int level, int version)
+ {
+ TestCompartment(level, version);
+ TestCompartmentType(level, version);
+ TestSpecies(level, version);
+ TestSpeciesType(level, version);
+ TestFunctionDefinition(level, version);
+ TestParameter(level, version);
+ TestAlgebraicRule(level, version);
+ TestAssignmentRule(level, version);
+ TestRateRule(level, version);
+ TestReaction(level, version);
+ TestKineticLaw(level, version);
+ TestLocalParameter(level, version);
+ TestEvent(level, version);
+ TestEventAssignment(level, version);
+ TestTrigger(level, version);
+ TestDelay(level, version);
+ TestPriority(level, version);
+ TestConstraint(level, version);
+ TestInitialAssignment(level, version);
+ TestSpeciesReference(level, version);
+ TestStoichiometryMath(level, version);
+ TestUnit(level, version);
+ TestUnitDefinition(level, version);
+ }
+
+ static void Main(string[] args)
+ {
+ Writer = Console.Out;
+
+ var versions = new List<int[]> { new [] {1, 1}
+ , new [] {1, 1}
+ , new [] {1, 2}
+ , new [] {2, 1}
+ , new [] {2, 2}
+ , new [] {2, 3}
+ , new [] {2, 4}
+ , new [] {3, 1}
+ };
+
+ Writer.WriteLine("Testing libSBML {0} xml parser: {1}", libsbml.getLibSBMLDottedVersion(), XMLParser);
+ Writer.WriteLine();
+ Writer.WriteLine("Parser, Level, Version, Element, Line, Column, ErrorId, ShortMessage, XML Snippet");
+
+ foreach (var item in versions)
+ {
+ TestSBMLLevelVersion(item[0], item[1]);
+ }
+
+ //Console.ReadKey();
+
+ }
+ }
+}
Added: trunk/libsbml/dev/utilities/comparelinenumbers/README.txt
===================================================================
--- trunk/libsbml/dev/utilities/comparelinenumbers/README.txt (rev 0)
+++ trunk/libsbml/dev/utilities/comparelinenumbers/README.txt 2012-01-26 20:36:16 UTC (rev 15322)
@@ -0,0 +1,10 @@
+The LibSBMLLineNumbers.cs file goes constructs invalid SBMLDocuments containing
+all the different SBML components. Next it validates the document printing the
+errors and error locations in CSV format.
+
+Once compiled the program can simply run with the libsbml C# bindings using the
+different XML parsers which enables us to compare the error location reported by
+each parser.
+
+See also pivotal:
+https://www.pivotaltracker.com/story/show/23689513
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|