testchol.java

来自「JAVA 数学程序库 提供常规的数值计算程序包」· Java 代码 · 共 42 行

JAVA
42
字号
package jmathlibtests.toolbox.jmathlib.matrix;

import jmathlib.core.interpreter.Interpreter;
import jmathlib.tools.junit.framework.*;
import jmathlibtests.Compare;

public class testChol extends TestCase {
	protected Interpreter ml;
	
    public testChol(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(testChol.class);
	}

    /****** not() ************************************************************/
	public void testNot01() {
        ml.executeExpression("aa=not(1);");
		assertTrue(!ml.getScalarValueBoolean("aa"));
	}
    public void testNot02() {
        ml.executeExpression("aaa=not(0)");
		assertTrue(ml.getScalarValueBoolean("aaa"));
	}
    public void testNot03() {
        double[][] a = {{1.0, 2.0, 3.0},{-1.0, 0.0, 0.0},{11.23, -1.5, 0.0}};
        boolean[][] b = {{false, false, false},{ false, true, true},{ false,false, true}};
        ml.setArray("a", a, null);
        ml.executeExpression("setdebug(1)");
        ml.executeExpression("who, z = not(a)");
 		assertTrue(Compare.ArrayEquals(b, ml.getArrayValueBoolean("z")));
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?