示例#1
0
文件: TestNumpy.java 项目: Macowe/jep
 /**
  * Helper method to support running the main() method to run from Java instead of python
  *
  * @param jep
  */
 public void runFromJava(Jep jep) {
   try {
     jep.eval("import test_numpy");
     jep.eval("v = test_numpy.TestNumpy('testArgReturn')");
     jep.eval("v.setUp()");
     for (int i = 0; i < REPEAT; i++) {
       this.testSetAndGet(jep);
     }
     for (int i = 0; i < REPEAT; i++) {
       jep.eval("v.testArgReturn()");
     }
     System.out.println("return NDArray from Java checked out ok");
     for (int i = 0; i < REPEAT; i++) {
       jep.eval("v.testMultiDimensional()");
     }
     System.out.println("multi dimensional arrays checked out ok");
     for (int i = 0; i < REPEAT; i++) {
       jep.eval("v.testArrayParams()");
     }
     System.out.println("Passing ndarrays to Java method as Java primitive[] checked out ok");
   } catch (JepException e) {
     e.printStackTrace();
   } finally {
     if (jep != null) jep.close();
   }
 }
示例#2
0
文件: TestNumpy.java 项目: Macowe/jep
 /**
  * This main() is for running the tests from Java. If running from the tests from python, use
  * python setup.py test.
  *
  * @param args
  */
 public static void main(String[] args) {
   File pwd = new File("tests");
   TestNumpy test = null;
   Jep jep = null;
   try {
     test = new TestNumpy();
     jep = new Jep(false, pwd.getPath());
     test.runFromJava(jep);
     test.testNDArraySafety();
   } catch (JepException e) {
     e.printStackTrace();
   } finally {
     if (jep != null) {
       jep.close();
     }
   }
 }
示例#3
0
文件: TestNumpy.java 项目: mrj0/jep
 public static void main(String[] args) {
   TestNumpy test = null;
   Jep jep = null;
   try {
     test = new TestNumpy();
     jep = new Jep(false, ".");
     test.testNDArraySafety();
     test.testSetAndGet(jep);
   } catch (Throwable e) {
     e.printStackTrace();
     System.exit(1);
   } finally {
     if (jep != null) {
       jep.close();
     }
   }
   System.exit(0);
 }