Skip to content

Commit

Permalink
#236: Fixed one of the CurrentIteration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jvdb committed Jul 18, 2018
1 parent a294916 commit ec291c2
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import static io.parsingdata.metal.Shorthand.con;
import static io.parsingdata.metal.Shorthand.def;
import static io.parsingdata.metal.Shorthand.eq;
import static io.parsingdata.metal.Shorthand.ltNum;
import static io.parsingdata.metal.Shorthand.not;
import static io.parsingdata.metal.Shorthand.rep;
import static io.parsingdata.metal.Shorthand.repn;
import static io.parsingdata.metal.Shorthand.seq;
Expand All @@ -39,13 +39,14 @@
public class CurrentIterationTest extends ParameterizedParse {

public static final Token VALUE_EQ_ITERATION = def("value", con(1), eq(CURRENT_ITERATION));
public static final Token VALUE_EQ_255 = def("value", con(1), eq(con(255)));

@Parameterized.Parameters(name="{0} ({4})")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
{ "[0, 1, 2, 3, 255] rep(CURRENT_ITERATION), def(255)", seq(rep(VALUE_EQ_ITERATION), def("value", con(1), eq(con(255)))), stream(0, 1, 2, 3, 255), enc(), true },
{ "[0, 1, 2, 3, 255] rep(CURRENT_ITERATION), def(255)", seq(rep(VALUE_EQ_ITERATION), VALUE_EQ_255), stream(0, 1, 2, 3, 255), enc(), true },
{ "[0, 1, 2, 3] repn=3(CURRENT_ITERATION)", repn(VALUE_EQ_ITERATION, con(4)), stream(0, 1, 2, 3), enc(), true },
{ "[255, 0, 1, 2, 3] def(255), while<3(CURRENT_ITERATION)", seq(def("value", con(1), eq(con(255))), whl(VALUE_EQ_ITERATION, ltNum(con(3)))), stream(255, 0, 1, 2, 3), enc(), true },
{ "[255, 0, 1, 2, 3, 255] def(255), while<3(CURRENT_ITERATION), def (255)", seq(VALUE_EQ_255, whl(VALUE_EQ_ITERATION, not(eq(con(3)))), VALUE_EQ_255), stream(255, 0, 1, 2, 3, 255), enc(), true },
{ "[0, 0, 1, 2, 1, 0, 1, 2] repn=2(CURRENT_ITERATION, repn=3(CURRENT_ITERATION))", repn(seq(VALUE_EQ_ITERATION, repn(VALUE_EQ_ITERATION, con(3))), con(2)), stream(0, 0, 1, 2, 1, 0, 1, 2), enc(), true },
{ "[0, 0] seq(CURRENT_ITERATION, ...)", seq(VALUE_EQ_ITERATION, VALUE_EQ_ITERATION), stream(0, 0), enc(), true }
});
Expand Down

0 comments on commit ec291c2

Please sign in to comment.