Search in sources :

Example 1 with TestContainer

use of tech.pegasys.teku.infrastructure.ssz.TestContainers.TestContainer in project teku by ConsenSys.

the class SszListHintsTest method listTypesTestParameters.

static Stream<Arguments> listTypesTestParameters() {
    Random random = new Random(1);
    SszSchema<?> listElementType1 = TestContainer.SSZ_SCHEMA;
    Supplier<TestContainer> elementSupplier1 = () -> {
        Bytes32 bytes32 = Bytes32.random();
        TestSubContainer subContainer = new TestSubContainer(UInt64.fromLongBits(random.nextLong()), bytes32);
        return new TestContainer(subContainer, UInt64.fromLongBits(random.nextLong()));
    };
    SszSchema<?> listElementType2 = TestSmallContainer.SSZ_SCHEMA;
    Supplier<TestSmallContainer> elementSupplier2 = () -> new TestSmallContainer(random.nextBoolean());
    SszSchema<?> listElementType3 = TestByteVectorContainer.SSZ_SCHEMA;
    Supplier<TestByteVectorContainer> elementSupplier3 = () -> TestByteVectorContainer.random(random);
    SszSchema<?> listElementType4 = TestDoubleSuperContainer.SSZ_SCHEMA;
    Supplier<TestDoubleSuperContainer> elementSupplier4 = () -> new TestDoubleSuperContainer(random.nextLong(), TestByteVectorContainer.random(random), random.nextLong(), TestByteVectorContainer.random(random), random.nextLong());
    return Stream.of(Arguments.of(listElementType1, 3, elementSupplier1), Arguments.of(listElementType1, 4, elementSupplier1), Arguments.of(listElementType1, 5, elementSupplier1), Arguments.of(listElementType1, 15, elementSupplier1), Arguments.of(listElementType1, 16, elementSupplier1), Arguments.of(listElementType1, 17, elementSupplier1), Arguments.of(listElementType1, 100, elementSupplier1), Arguments.of(listElementType1, 127, elementSupplier1), Arguments.of(listElementType1, 128, elementSupplier1), Arguments.of(listElementType1, 129, elementSupplier1), Arguments.of(listElementType1, 255, elementSupplier1), Arguments.of(listElementType1, 256, elementSupplier1), Arguments.of(listElementType1, 257, elementSupplier1), Arguments.of(listElementType1, Integer.MAX_VALUE, elementSupplier1), Arguments.of(listElementType1, 16L * Integer.MAX_VALUE, elementSupplier1), Arguments.of(listElementType2, 15, elementSupplier2), Arguments.of(listElementType2, 16, elementSupplier2), Arguments.of(listElementType2, 17, elementSupplier2), Arguments.of(listElementType3, 15, elementSupplier3), Arguments.of(listElementType3, 16, elementSupplier3), Arguments.of(listElementType3, 17, elementSupplier3), Arguments.of(listElementType4, 15, elementSupplier4), Arguments.of(listElementType4, 16, elementSupplier4), Arguments.of(listElementType4, 17, elementSupplier4));
}
Also used : Random(java.util.Random) TestContainer(tech.pegasys.teku.infrastructure.ssz.TestContainers.TestContainer) TestByteVectorContainer(tech.pegasys.teku.infrastructure.ssz.TestContainers.TestByteVectorContainer) Bytes32(org.apache.tuweni.bytes.Bytes32) TestSmallContainer(tech.pegasys.teku.infrastructure.ssz.TestContainers.TestSmallContainer) TestSubContainer(tech.pegasys.teku.infrastructure.ssz.TestContainers.TestSubContainer) TestDoubleSuperContainer(tech.pegasys.teku.infrastructure.ssz.TestContainers.TestDoubleSuperContainer)

Aggregations

Random (java.util.Random)1 Bytes32 (org.apache.tuweni.bytes.Bytes32)1 TestByteVectorContainer (tech.pegasys.teku.infrastructure.ssz.TestContainers.TestByteVectorContainer)1 TestContainer (tech.pegasys.teku.infrastructure.ssz.TestContainers.TestContainer)1 TestDoubleSuperContainer (tech.pegasys.teku.infrastructure.ssz.TestContainers.TestDoubleSuperContainer)1 TestSmallContainer (tech.pegasys.teku.infrastructure.ssz.TestContainers.TestSmallContainer)1 TestSubContainer (tech.pegasys.teku.infrastructure.ssz.TestContainers.TestSubContainer)1