⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testor.java

📁 JAVA 数学程序库 提供常规的数值计算程序包
💻 JAVA
字号:
package jmathlibtests.toolbox.jmathlib.matrix;

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

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

    /****** Or() ***********************************************************/
	public void testOr01() {
        ml.executeExpression("a=or(1,1);");
		assertTrue(1 == ml.getScalarValueRe("a"));
        assertTrue(0 == ml.getScalarValueIm("a"));
	}
    public void testOr02() {
        ml.executeExpression("b=or(1,0)");
		assertTrue(1 == ml.getScalarValueRe("b"));
        assertTrue(0 == ml.getScalarValueIm("b"));
	}
    public void testOr03() {
        ml.executeExpression("b=or(0,1)");
		assertTrue(1 == ml.getScalarValueRe("b"));
        assertTrue(0 == ml.getScalarValueIm("b"));
    }
    public void testOr04() {
        ml.executeExpression("b=or(0,0)");
		assertTrue(0 == ml.getScalarValueRe("b"));
        assertTrue(0 == ml.getScalarValueIm("b"));
	}
    public void testOr05() {
        double[][] a = {{-1.0, 3.0, 0.0},{0.0, 10.0, 0.5},{0.0, 0.0, 0.0}};
        double[][] b = {{ 0.0, 7.0, 0.0},{0.0,  0.0, 0.0},{6.0, 0.0, 7.0}};
        double[][] c = {{ 1.0, 1.0, 0.0},{0.0,  1.0, 1.0},{1.0, 0.0, 1.0}};
        double[][] d = {{ 0.0, 0.0, 0.0},{0.0,  0.0, 0.0},{0.0, 0.0, 0.0}};
        ml.setArray("a", a, d);
        ml.setArray("b", b, d);
        ml.executeExpression("z = or(a,b)");
 		assertTrue(Compare.ArrayEquals(c, ml.getArrayValueRe("z")));
 		assertTrue(Compare.ArrayEquals(d, ml.getArrayValueIm("z")));
	}
 
}

⌨️ 快捷键说明

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