ATerm pattern =
factory.getPureFactory().parse(
"[\"m1\",l(\"l1\"),\"sep\",l(\"l2\"),\"m2\",l(\"l3\"),\"sep\",l(\"l4\"),\"m3\",l(\"l5\"),\"sep\",l(\"l6\"),\"m4\"]");
Separated sep = factory.SeparatedFromTerm(pattern);
testAssert(sep.toTerm().isEqual(pattern), " fromTerm == toTerm separated lists");
ATerm patternReversed =
factory.getPureFactory().parse(
"[\"m4\",l(\"l5\"),\"sep\",l(\"l6\"),\"m3\",l(\"l3\"),\"sep\",l(\"l4\"),\"m2\",l(\"l1\"),\"sep\",l(\"l2\"),\"m1\"]");
Separated sepReversed = factory.SeparatedFromTerm(patternReversed);
testAssert(sep.reverse().isEqual(sepReversed), " separated reverse test");
testAssert(sep.reverseSeparated().toTerm().isEqual(patternReversed), "separated reverse toTerm test");
Module head = sep.getHead();