@Override protected Object runFunctionNative(BdsThread bdsThread) { String expected = bdsThread.getString("expected"); String value = bdsThread.getString("value"); if (!expected.equals(value)) // throw new RuntimeException("Expecting '" + expected + "', but was '" + value + "'"); return true; }
@Override public void runFunction(BdsThread bdsThread) { try { // Run function Object result = runFunctionNative(bdsThread); bdsThread.setReturnValue(result); // Set result in scope } catch (Throwable t) { // Exception caused by failed assertion if (bdsThread.isDebug()) t.printStackTrace(); bdsThread.assertionFailed(this, t.getMessage()); } }
@Override protected Object runFunctionNative(BdsThread bdsThread) { return (Double) Math.hypot(bdsThread.getReal("x"), bdsThread.getReal("y")); }