testexpression.java
来自「JAVA 数学程序库 提供常规的数值计算程序包」· Java 代码 · 共 38 行
JAVA
38 行
package jmathlibtests.core.tokens;
import jmathlib.core.interpreter.Interpreter;
import jmathlib.tools.junit.framework.*;
public class testExpression extends TestCase {
protected Interpreter ml;
public testExpression(String name) {
super(name);
}
public static void main (String[] args) {
jmathlib.tools.junit.textui.TestRunner.run (suite());
}
protected void setUp() {
ml = new Interpreter(true);
}
public static Test suite() {
return new TestSuite(testExpression.class);
}
/************* simple expressions ****************************************/
public void test001() {
ml.executeExpression("a=2+3");
assertTrue(5 == ml.getScalarValueRe("a"));
}
// test case for bug: 859689 meshgrid number of output arguments!=2
// solution: the evaluation of expressions did not work correctly for matrices on the left handside
public void test002() {
ml.executeExpression("[x,y]=meshgrid(3,4)");
assertTrue(3 == ml.getScalarValueRe("x"));
assertTrue(4 == ml.getScalarValueRe("y"));
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?