Until extends Token { public Until(final String name, final ValueExpression initialSize, final ValueExpression stepSize, final ValueExpression maxSize, final Token terminator, final Encoding encoding) { super(checkNotEmpty(name, "name"), encoding); this.initialSize = initialSize == null ? DEFAULT_INITIAL : initialSize; this.stepSize = stepSize == null ? DEFAULT_STEP : stepSize; this.maxSize = maxSize == null ? DEFAULT_MAX : maxSize; this.terminator = checkNotNull(terminator, "terminator"); } Until(final String name, final ValueExpression initialSize, final ValueExpression stepSize, final ValueExpression maxSize, final Token terminator, final Encoding encoding); @Override String toString(); @Override boolean equals(final Object obj); @Override int hashCode(); static final ValueExpression DEFAULT_INITIAL; static final ValueExpression DEFAULT_STEP; static final ValueExpression DEFAULT_MAX; final ValueExpression initialSize; final ValueExpression stepSize; final ValueExpression maxSize; final Token terminator; }
@Test public void allDefaultValueExpressions() { assertTrue(until("value", def("terminator", 1, eq(con(0)))).parse(env(stream(1, 2, 3, 0))).isPresent()); }
@Test public void errorNegativeSize() { assertFalse(until("value", con(-1, signed()), def("terminator", 1, eq(con(0)))).parse(env(stream(1, 2, 3, 0))).isPresent()); }