use of org.sirix.service.xml.xpath.AtomicValue in project sirix by sirixdb.
the class MulOpAxisTest method testOperate.
@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.getReader(), holder.getReader().getItemList().addItem(item1));
AbstractAxis op2 = new LiteralExpr(holder.getReader(), holder.getReader().getItemList().addItem(item2));
AbstractObAxis axis = new MulOpAxis(holder.getReader(), op1, op2);
assertEquals(true, axis.hasNext());
axis.next();
assertThat(6.0, is(Double.parseDouble(holder.getReader().getValue())));
assertEquals(holder.getReader().keyForName("xs:double"), holder.getReader().getTypeKey());
assertEquals(false, axis.hasNext());
}
use of org.sirix.service.xml.xpath.AtomicValue in project sirix by sirixdb.
the class SubOpAxisTest method testOperate.
@Test
public final void testOperate() throws SirixException {
AtomicValue item1 = new AtomicValue(1.0, Type.DOUBLE);
AtomicValue item2 = new AtomicValue(2.0, Type.DOUBLE);
AbstractAxis op1 = new LiteralExpr(holder.getReader(), holder.getReader().getItemList().addItem(item1));
AbstractAxis op2 = new LiteralExpr(holder.getReader(), holder.getReader().getItemList().addItem(item2));
AbstractObAxis axis = new SubOpAxis(holder.getReader(), op1, op2);
assertEquals(true, axis.hasNext());
axis.next();
assertThat(-1.0, is(Double.parseDouble(holder.getReader().getValue())));
assertEquals(holder.getReader().keyForName("xs:double"), holder.getReader().getTypeKey());
assertEquals(false, axis.hasNext());
}
Aggregations