<commit_before>/*
 * Copyright 2016-2020 chronicle.software
 *
 * https://chronicle.software
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.openhft.chronicle.wire;

import net.openhft.chronicle.bytes.Bytes;
import net.openhft.chronicle.bytes.BytesMarshallable;
import net.openhft.chronicle.bytes.util.BinaryLengthLength;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.lang.reflect.Field;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZonedDateTime;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;

import static net.openhft.chronicle.wire.BinaryWireCode.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

@SuppressWarnings("rawtypes")
@RunWith(value = Parameterized.class)
public class SkipValueTest {

    private final String name;
    private final int code;
    private final Consumer<ValueOut> valueOutConsumer;

    public SkipValueTest(String name, int code, Consumer<ValueOut> valueOutConsumer) {
        this.name = name;
        this.code = code;
        this.valueOutConsumer = valueOutConsumer;
    }

    static Consumer<ValueOut> wr(Consumer<ValueOut> valueOutConsumer) {
        return valueOutConsumer;
    }

    @NotNull
    @Parameterized.Parameters(name = "{index}: {0}")
    public static Collection<Object[]> data() throws IllegalAccessException {

        Object[][] list = {
                {null, BYTES_LENGTH8, wr(v -> v.object(Dto8.class, new Dto8()))},
                {null, BYTES_LENGTH16, wr(v -> v.object(Dto16.class, new Dto16()))},
                {null, BYTES_LENGTH32, wr(v -> v.object(Dto32.class, new Dto32()))},
//                {null, BinaryWireCode.BYTES_MARSHALLABLE, wr(v -> v.object(BM.class, new BM()))}
//        public static final int U8_ARRAY = 0x8A;
//        public static final int I64_ARRAY = 0x8D;
//                {null, U8_ARRAY, wr(v -> v.bytes(new byte[4]))},
                {null, U8_ARRAY, wr(v -> {
                    v.bytes(new byte[4]);
                    v.wireOut().bytes().readPosition(2);
                })},
                {null, I64_ARRAY, wr(v -> {
                    v.int64array(4);
                    v.wireOut().bytes().readPosition(7);
                })},
                {null, PADDING32, wr(v -> v.wireOut().addPadding(33).getValueOut().text("hi"))},
                {null, PADDING, wr(v -> v.wireOut().addPadding(3).getValueOut().text("hi"))},
                {null, FLOAT32, wr(v -> v.float32(1.2345678f))},
                {null, FLOAT64, wr(v -> v.float64(Math.PI))},
                {null, FLOAT_STOP_2, wr(v -> v.float32(1.23f))},
                {null, FLOAT_STOP_4, wr(v -> v.float32(0.0123f))},<commit_msg>Added tests for BinaryWire valueIn.skipValue()<commit_after>/*
 * Copyright 2016-2020 chronicle.software
 *
 * https://chronicle.software
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.openhft.chronicle.wire;

import net.openhft.chronicle.bytes.Bytes;
import net.openhft.chronicle.bytes.BytesMarshallable;
import net.openhft.chronicle.bytes.util.BinaryLengthLength;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.lang.reflect.Field;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZonedDateTime;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;

import static net.openhft.chronicle.wire.BinaryWireCode.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

@SuppressWarnings("rawtypes")
@RunWith(value = Parameterized.class)
public class SkipValueTest {

    private final String name;
    private final int code;
    private final Consumer<ValueOut> valueOutConsumer;

    public SkipValueTest(String name, int code, Consumer<ValueOut> valueOutConsumer) {
        this.name = name;
        this.code = code;
        this.valueOutConsumer = valueOutConsumer;
    }

    static Consumer<ValueOut> wr(Consumer<ValueOut> valueOutConsumer) {
        return valueOutConsumer;
    }

    @NotNull
    @Parameterized.Parameters(name = "{index}: {0}")
    public static Collection<Object[]> data() throws IllegalAccessException {

        Object[][] list = {
                {null, BYTES_LENGTH8, wr(v -> v.object(Dto8.class, new Dto8()))},
                {null, BYTES_LENGTH16, wr(v -> v.object(Dto16.class, new Dto16()))},
                {null, BYTES_LENGTH32, wr(v -> v.object(Dto32.class, new Dto32()))},
/*                {null, BYTES_MARSHALLABLE, wr(v -> {
                    v.object(BM.class, new BM());
                    v.wireOut().bytes().readPosition(5);
                })},*/
                {null, U8_ARRAY, wr(v -> {
                    v.bytes(new byte[4]);
                    v.wireOut().bytes().readPosition(2);
                })},
                {null, I64_ARRAY, wr(v -> {
                    v.int64array(4);
                    v.wireOut().bytes().readPosition(7);
                })},
                {null, PADDING32, wr(v -> v.wireOut().addPadding(33).getValueOut().text("hi"))},
                {null, PADDING, wr(v -> v.wireOut().addPadding(3).getValueOut().text("hi"))},
                {null, FLOAT32, wr(v -> v.float32(1.2345678f))},
                {null, FLOAT64, wr(v -> v.float64(Math.PI))},
                {null, FLOAT_STOP_2, wr(v -> v.float32(1.23f))},
                {null, FLOAT_STOP_4, wr(v -> v.float32(0.0123f))},
{'fraction_non_alphanumeric': 0.12898486851770236, 'fraction_numerical': 0.02262376964889085, 'mean_word_length': 2.8268690275435637, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 38, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '135673', 'n_tokens_mistral': 2156, 'n_tokens_neox': 2024, 'n_words': 493}