IDivOpAxis extends AbstractObAxis { @Override public Node operate(final AtomicValue mOperand1, final AtomicValue mOperand2) throws SirixXPathException { final Type returnType = getReturnType(mOperand1.getTypeKey(), mOperand2.getTypeKey()); final int typeKey = asXdmNodeReadTrx().keyForName(returnType.getStringRepr()); final byte[] value; try { final int op1 = (int) Double.parseDouble(new String(mOperand1.getRawValue())); final int op2 = (int) Double.parseDouble(new String(mOperand2.getRawValue())); final int iValue = op1 / op2; value = TypedValue.getBytes(iValue); return new AtomicValue(value, typeKey); } catch (final ArithmeticException e) { throw new XPathError(ErrorType.FOAR0001); } } IDivOpAxis(final XmlNodeReadOnlyTrx rtx, final Axis mOp1, final Axis mOp2); @Override Node operate(final AtomicValue mOperand1, final AtomicValue mOperand2);  }
@Test public final void testOperate() throws SirixException { AtomicValue item1 = new AtomicValue(3.0, Type.DOUBLE); AtomicValue item2 = new AtomicValue(2.0, Type.DOUBLE); AbstractAxis op1 = new LiteralExpr(holder.getXmlNodeReadTrx(), holder.getXmlNodeReadTrx().getItemList().addItem(item1)); AbstractAxis op2 = new LiteralExpr(holder.getXmlNodeReadTrx(), holder.getXmlNodeReadTrx().getItemList().addItem(item2)); AbstractObAxis axis = new IDivOpAxis(holder.getXmlNodeReadTrx(), op1, op2); assertEquals(true, axis.hasNext()); axis.next(); assertEquals(holder.getXmlNodeReadTrx().keyForName("xs:integer"), holder.getXmlNodeReadTrx().getTypeKey()); assertEquals(false, axis.hasNext()); }