use of com.yahoo.document.datatypes.IntegerFieldValue in project vespa by vespa-engine.
the class RandomTestCase method requireThatInputValueIsParsedAsMaxIfNoneIsConfigured.
@Test
public void requireThatInputValueIsParsedAsMaxIfNoneIsConfigured() {
for (int i = 0; i < 666; ++i) {
ExecutionContext ctx = new ExecutionContext().setValue(new IntegerFieldValue(69));
new RandomExpression().execute(ctx);
FieldValue val = ctx.getValue();
assertTrue(val instanceof IntegerFieldValue);
assertTrue(((IntegerFieldValue) val).getInteger() < 69);
}
}
use of com.yahoo.document.datatypes.IntegerFieldValue in project vespa by vespa-engine.
the class ToIntegerTestCase method requireThatValueIsConverted.
@Test
public void requireThatValueIsConverted() {
ExecutionContext ctx = new ExecutionContext(new SimpleTestAdapter());
ctx.setValue(new StringFieldValue("69")).execute(new ToIntegerExpression());
FieldValue val = ctx.getValue();
assertTrue(val instanceof IntegerFieldValue);
assertEquals(69, ((IntegerFieldValue) val).getInteger());
}
use of com.yahoo.document.datatypes.IntegerFieldValue in project vespa by vespa-engine.
the class ScriptTestCase method requireThatInputValueIsAvailableToAllStatements.
@Test
public void requireThatInputValueIsAvailableToAllStatements() {
SimpleTestAdapter adapter = new SimpleTestAdapter(new Field("out-1", DataType.INT), new Field("out-2", DataType.INT));
newStatement(new SetValueExpression(new IntegerFieldValue(69)), newScript(newStatement(new AttributeExpression("out-1"), new AttributeExpression("out-2")))).execute(adapter);
assertEquals(new IntegerFieldValue(69), adapter.getInputValue("out-1"));
assertEquals(new IntegerFieldValue(69), adapter.getInputValue("out-2"));
}
use of com.yahoo.document.datatypes.IntegerFieldValue in project vespa by vespa-engine.
the class ScriptTestCase method requireThatVariablesAreAvailableOutsideScript.
@Test
public void requireThatVariablesAreAvailableOutsideScript() {
SimpleTestAdapter adapter = new SimpleTestAdapter(new Field("out", DataType.INT));
newStatement(newScript(newStatement(new SetValueExpression(new IntegerFieldValue(69)), new SetVarExpression("tmp"))), new GetVarExpression("tmp"), new AttributeExpression("out")).execute(adapter);
assertEquals(new IntegerFieldValue(69), adapter.getInputValue("out"));
}
use of com.yahoo.document.datatypes.IntegerFieldValue in project vespa by vespa-engine.
the class SetVarTestCase method requireThatSymbolIsWritten.
@Test
public void requireThatSymbolIsWritten() {
ExecutionContext ctx = new ExecutionContext(new SimpleTestAdapter());
ctx.setValue(new IntegerFieldValue(69));
new SetVarExpression("out").execute(ctx);
FieldValue val = ctx.getVariable("out");
assertTrue(val instanceof IntegerFieldValue);
assertEquals(69, ((IntegerFieldValue) val).getInteger());
}
Aggregations