Thread: [Mathlib-commitlog] SF.net SVN: mathlib:[612] JMathLib/trunk/src/jmathlibtests/toolbox/general/ tes
Status: Beta
Brought to you by:
st_mueller
|
From: <st_...@us...> - 2009-01-05 13:06:47
|
Revision: 612
http://mathlib.svn.sourceforge.net/mathlib/?rev=612&view=rev
Author: st_mueller
Date: 2009-01-05 13:06:34 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
Modified Paths:
--------------
JMathLib/trunk/src/jmathlibtests/toolbox/general/testGlobal.java
Modified: JMathLib/trunk/src/jmathlibtests/toolbox/general/testGlobal.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/general/testGlobal.java 2009-01-05 13:06:15 UTC (rev 611)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/general/testGlobal.java 2009-01-05 13:06:34 UTC (rev 612)
@@ -60,11 +60,12 @@
Function doit = null;
//Expected an exception here
try {
- doit = funcParser.parseFunction(b.toString());
- } catch (MathLibException ex) {
+ doit = funcParser.parseFunction(b.toString());
+ doit.evaluate(null);
+ }
+ catch (MathLibException ex) {
exCaught = true;
}
- assertNull(doit);
assertTrue(exCaught);
}
@@ -89,7 +90,43 @@
b.append("doit;\n");
ml.executeExpression(b.toString());
double val = ml.getScalarValueRe("a");
- assertTrue(4 == val);
+ assertTrue(4 == val);
}
+ public void testGlobal10() {
+ ml.executeExpression("clear('all');");
+ ml.executeExpression("global asdf");
+ ml.executeExpression("asdf = 5");
+ assertTrue(5.0 == ml.getScalarValueRe("asdf"));
+ }
+
+ public void testGlobal11() {
+ ml.executeExpression("clear('all');");
+ ml.executeExpression("asdf = 55");
+ ml.executeExpression("global asdf");
+ assertTrue(55.0 == ml.getScalarValueRe("asdf"));
+ }
+
+ public void testGlobal100() {
+ ml.executeExpression("clear('all');");
+ ml.executeExpression("helloGlobal = 11.0");
+ ml.executeExpression("testGlobal001(8)");
+ assertTrue(11.0 == ml.getScalarValueRe("helloGlobal"));
+ ml.executeExpression("testGlobal001(77)");
+ assertTrue(11.0 == ml.getScalarValueRe("helloGlobal"));
+ }
+
+ public void testGlobal101() {
+ ml.executeExpression("clear('all');");
+ ml.executeExpression("global helloGlobal;");
+ ml.executeExpression("helloGlobal = 11.0");
+ assertTrue(11.0 == ml.getScalarValueRe("helloGlobal"));
+ ml.executeExpression("testGlobal001(88)");
+ assertTrue(88.0 == ml.getScalarValueRe("helloGlobal"));
+ ml.executeExpression("helloGlobal = 99.0");
+ assertTrue(99.0 == ml.getScalarValueRe("helloGlobal"));
+ ml.executeExpression("testGlobal001(88)");
+ assertTrue(88.0 == ml.getScalarValueRe("helloGlobal"));
+ }
+
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-24 09:13:39
|
Revision: 743
http://mathlib.svn.sourceforge.net/mathlib/?rev=743&view=rev
Author: st_mueller
Date: 2009-01-24 09:13:36 +0000 (Sat, 24 Jan 2009)
Log Message:
-----------
changed signature of evaluate(Token[] operands)
to
evaluate(Token[] operands, GlobalValues globals)
Modified Paths:
--------------
JMathLib/trunk/src/jmathlibtests/toolbox/general/testGlobal.java
Modified: JMathLib/trunk/src/jmathlibtests/toolbox/general/testGlobal.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/general/testGlobal.java 2009-01-24 09:12:07 UTC (rev 742)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/general/testGlobal.java 2009-01-24 09:13:36 UTC (rev 743)
@@ -1,3 +1,12 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author: Stefan Mueller (st...@he...)
+ * (c) 2008, 2009
+ */
+
package jmathlibtests.toolbox.general;
import jmathlib.core.interpreter.Interpreter;
@@ -61,7 +70,7 @@
//Expected an exception here
try {
doit = funcParser.parseFunction(b.toString());
- doit.evaluate(null);
+ doit.evaluate(null, ml.globals);
}
catch (MathLibException ex) {
exCaught = true;
@@ -81,7 +90,7 @@
FunctionParser funcParser = new FunctionParser();
Function doit = funcParser.parseFunction(b.toString());
assertNotNull(doit);
- ml.getFunctionManager().addFunctionLoader(new TestFunctionLoader(doit));
+ ml.globals.getFunctionManager().addFunctionLoader(new TestFunctionLoader(doit));
b = new StringBuffer();
b.append("a = 1;\n");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-26 19:52:33
|
Revision: 785
http://mathlib.svn.sourceforge.net/mathlib/?rev=785&view=rev
Author: st_mueller
Date: 2009-01-26 19:52:31 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
renamed MathLibException into JMathLibException
Modified Paths:
--------------
JMathLib/trunk/src/jmathlibtests/toolbox/general/testGlobal.java
Modified: JMathLib/trunk/src/jmathlibtests/toolbox/general/testGlobal.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/general/testGlobal.java 2009-01-26 19:52:01 UTC (rev 784)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/general/testGlobal.java 2009-01-26 19:52:31 UTC (rev 785)
@@ -72,7 +72,7 @@
doit = funcParser.parseFunction(b.toString());
doit.evaluate(null, ml.globals);
}
- catch (MathLibException ex) {
+ catch (JMathLibException ex) {
exCaught = true;
}
assertTrue(exCaught);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|