Example #1
0
 @Before
 public void before() throws IOException {
   String path = tmp.newFolder().getCanonicalPath();
   env = new Env();
   env.setMapSize(16 * 4096);
   env.open(path);
   db = env.openDatabase();
 }
Example #2
0
 void checkStr(String s, double d) {
   Env env = Exec2.exec(s);
   assertFalse("Should be scalar result not Frame: " + s, env.isAry());
   assertFalse(env.isFcn());
   double res = env.popDbl();
   assertEquals(d, res, d / 1e8);
   env.remove_and_unlock();
   debug_print(s);
 }
Example #3
0
 void checkStr(String s, String err) {
   Env env = null;
   try {
     env = Exec2.exec(s);
     env.remove_and_unlock();
     fail(); // Supposed to throw; reaching here is an error
   } catch (IllegalArgumentException e) {
     assertEquals(err, e.getMessage());
   }
   debug_print(s);
 }
Example #4
0
 void checkStr(String s) {
   Env env = null;
   try {
     env = Exec2.exec(s);
     if (env.isAry()) { // Print complete frames for inspection
       Frame res = env.popAry();
       String skey = env.key();
       System.out.println(res.toStringAll());
       env.subRef(res, skey); // But then end lifetime
     } else {
       System.out.println(env.resultString());
     }
   } catch (IllegalArgumentException iae) {
     System.out.println(iae.getMessage());
   }
   if (env != null) env.remove_and_unlock();
   debug_print(s);
 }
Example #5
0
 @After
 public void after() {
   db.close();
   env.close();
 }