use of de.prob.translator.types.Sequence in project probparsers by bendisposto.
the class TestTranslator method testTranslateEmptySequence.
@Test
public void testTranslateEmptySequence() throws Exception {
Sequence s = (Sequence) Translator.translate("[]");
assertTrue(s.size() == 0);
}
use of de.prob.translator.types.Sequence in project probparsers by bendisposto.
the class TranslatingVisitor method caseASequenceExtensionExpression.
@Override
public void caseASequenceExtensionExpression(ASequenceExtensionExpression node) {
List<BObject> s = new ArrayList<BObject>();
for (PExpression e : node.getExpression()) {
e.apply(this);
s.add(this.getResult());
}
this.setResult(new Sequence(s));
}
use of de.prob.translator.types.Sequence in project probparsers by bendisposto.
the class TestTranslator method testTranslateSequence.
@Test
public void testTranslateSequence() throws Exception {
Sequence s = (Sequence) Translator.translate("[1,2,3]");
assertTrue(s.size() == 3);
for (int i = 1; i <= s.size(); i++) {
assertTrue(s.get(i).equals(Number.build("" + (i))));
}
}
use of de.prob.translator.types.Sequence in project probparsers by bendisposto.
the class TestTranslator method testTranslateRecordWithSequenceValues.
@Test
public void testTranslateRecordWithSequenceValues() throws Exception {
Record o = (Record) Translator.translate("rec(key1:[1,2,3])");
Sequence a = (Sequence) o.get("key1");
assertTrue(a.contains(Number.build(1)));
}