Skip to content

Commit

Permalink
issues/228 - Tidy up for review of nested CLTuples
Browse files Browse the repository at this point in the history
  • Loading branch information
meywood committed Oct 25, 2023
1 parent 6a8c805 commit 00f56f3
Showing 1 changed file with 24 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ public class NestedTupleStepDefinitions {
private CLValueTuple3 tuple3Root;

@Given("that a nested Tuple1 is defined as \\(\\({long})) using U32 numeric values")
public void thatANestedTupleIsDefinedAsUsingUNumericValue(long arg0) throws ValueSerializationException {
final CLValueTuple1 innerTuple = new CLValueTuple1(Unit.with(new CLValueU32(arg0)));
tuple1Root = new CLValueTuple1(Unit.with(innerTuple));
public void thatANestedTupleIsDefinedAsUsingUNumericValue(final long arg0) throws ValueSerializationException {
tuple1Root = new CLValueTuple1(Unit.with(new CLValueTuple1(Unit.with(new CLValueU32(arg0)))));
}

@Then("the {string} element of the Tuple{int} is {string}")
Expand All @@ -52,10 +51,20 @@ public void theNthElementOfTheTupleXIs(final String elementIndex, final int tupl
}

@Given("that a nested Tuple2 is defined as \\({long}, \\({long}, \\({long}, {long}))) using U32 numeric values")
public void thatATupleIsDefinedAs(final long arg0, final long arg1, final long arg2, final long arg3) throws ValueSerializationException {
final CLValueTuple2 innerTuple2 = new CLValueTuple2(Pair.with(new CLValueU32(arg2), new CLValueU32(arg3)));
final CLValueTuple2 innerTuple1 = new CLValueTuple2(Pair.with(new CLValueU32(arg1), innerTuple2));
tuple2Root = new CLValueTuple2(Pair.with(new CLValueU32(arg0), innerTuple1));
public void thatATupleIsDefinedAs(final long arg0,
final long arg1,
final long arg2,
final long arg3) throws ValueSerializationException {
tuple2Root = new CLValueTuple2(Pair.with(
new CLValueU32(arg0),
new CLValueTuple2(Pair.with(
new CLValueU32(arg1),
new CLValueTuple2(Pair.with(
new CLValueU32(arg2),
new CLValueU32(arg3)
))
))
));
}

@And("the Tuple{long} bytes are {string}")
Expand All @@ -64,8 +73,13 @@ public void theTuplesBytesAre(final long tuple, final String hexBytes) {
}

@Given("that a nested Tuple3 is defined as \\({long}, {long}, \\({long}, {long}, \\({long}, {long}, {long}))) using U32 numeric values")
public void thatANestedTupleIsDefinedAsUsingUNumericValues(long arg0, long arg1, long arg2, long arg3, long arg4, long arg5, long arg6) throws ValueSerializationException {

public void thatANestedTupleIsDefinedAsUsingUNumericValues(final long arg0,
final long arg1,
final long arg2,
final long arg3,
final long arg4,
final long arg5,
final long arg6) throws ValueSerializationException {
tuple3Root = new CLValueTuple3(Triplet.with(
new CLValueU32(arg0),
new CLValueU32(arg1),
Expand Down Expand Up @@ -118,7 +132,7 @@ public void thatANestedTupleIsDefinedAsUsingUNumericValues(long arg0, long arg1,
throw new NotImplementedException("Tuple " + tuple + " " + valueIndex + " not implemented");
}

private List<Long> getTupleValues(final AbstractCLValue<?,?> tuple) {
private List<Long> getTupleValues(final AbstractCLValue<?, ?> tuple) {
return getTupleValues(tuple, new ArrayList<>());
}

Expand Down Expand Up @@ -155,5 +169,3 @@ private void processTupleValue(final ArrayList<Long> tupleValues, final Object v
}
}
}


0 comments on commit 00f56f3

Please sign in to comment.