<commit_before>package org.libsmith.anvil.collections;


import org.junit.Test;
import org.libsmith.anvil.collections.MockEnums.*;

import java.math.BigInteger;
import java.util.*;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.libsmith.anvil.collections.MockEnums.LongLongEnum.*;

/**
 * @author <NAME> <<EMAIL>>
 * @created 05.08.2016 23:04
 */
public class EnumSetPackerTest {

    @SuppressWarnings("serial")
    private static final Map<Number, Set<LongLongEnum>> STATIC_TEST_DATA =
            Collections.unmodifiableMap(new HashMap<Number, Set<LongLongEnum>>() {{
                put(0x00_00_00_00_00_00_00_00L, EnumSet.noneOf(LongLongEnum.class));
                put(0xFF_FF_FF_FF_FF_FF_FF_FFL, EnumSet.range(_0, _63));
                put(0x7F_FF_FF_FF_FF_FF_FF_FFL, EnumSet.range(_0, _62));
                put(0xFF_FF_FF_FF_FF_FF_FF_FEL, EnumSet.range(_1, _63));
                put(0x80_00_00_00_00_00_00_01L, EnumSet.of(_0, _63));
                put(0x00_80_04_22_81_00_00_81L, EnumSet.of(_0, _7, _55, _42, _24, _31, _33, _37));
                put(0x80_00_04_00_01_00_00_04L, EnumSet.of(_2, _24, _42, _63));

                put(new BigInteger("FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF".replaceAll(" ", ""), 16),
                    EnumSet.allOf(LongLongEnum.class));
                put(new BigInteger("80 00 00 00  00 04 04 00  00 00 04 00  00 00 00 14".replaceAll(" ", ""), 16),
                    EnumSet.of(_2, _4, _42, _74, _82, _127));
            }});

    @Test
    public void packToByteTest() throws Exception {
        assertThat(
                EnumSetPacker.of(ByteEnum.class).packToByte(EnumSet.allOf(ByteEnum.class))
        ).isEqualTo((byte) -1);
<commit_msg>Add test to vararg version of pack to methods in EnumSetPacketTest<commit_after>package org.libsmith.anvil.collections;


import org.junit.Test;
import org.libsmith.anvil.collections.MockEnums.*;

import java.math.BigInteger;
import java.util.*;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.libsmith.anvil.collections.MockEnums.LongLongEnum.*;

/**
 * @author <NAME> <<EMAIL>>
 * @created 05.08.2016 23:04
 */
public class EnumSetPackerTest {

    @SuppressWarnings("serial")
    private static final Map<Number, Set<LongLongEnum>> STATIC_TEST_DATA =
            Collections.unmodifiableMap(new HashMap<Number, Set<LongLongEnum>>() {{
                put(0x00_00_00_00_00_00_00_00L, EnumSet.noneOf(LongLongEnum.class));
                put(0xFF_FF_FF_FF_FF_FF_FF_FFL, EnumSet.range(_0, _63));
                put(0x7F_FF_FF_FF_FF_FF_FF_FFL, EnumSet.range(_0, _62));
                put(0xFF_FF_FF_FF_FF_FF_FF_FEL, EnumSet.range(_1, _63));
                put(0x80_00_00_00_00_00_00_01L, EnumSet.of(_0, _63));
                put(0x00_80_04_22_81_00_00_81L, EnumSet.of(_0, _7, _55, _42, _24, _31, _33, _37));
                put(0x80_00_04_00_01_00_00_04L, EnumSet.of(_2, _24, _42, _63));

                put(new BigInteger("FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF".replaceAll(" ", ""), 16),
                    EnumSet.allOf(LongLongEnum.class));
                put(new BigInteger("80 00 00 00  00 04 04 00  00 00 04 00  00 00 00 14".replaceAll(" ", ""), 16),
                    EnumSet.of(_2, _4, _42, _74, _82, _127));
            }});

    @Test
    public void packToWithVarargTest() {
        EnumSetPacker<LongLongEnum> packer = EnumSetPacker.of(LongLongEnum.class);
        assertThat(packer.packToByte(_4, _2)).isEqualTo(packer.packToByte(EnumSet.of(_4, _2)));
        assertThat(packer.packToShort(_4, _2)).isEqualTo(packer.packToShort(EnumSet.of(_4, _2)));
        assertThat(packer.packToInt(_4, _2)).isEqualTo(packer.packToInt(EnumSet.of(_4, _2)));
        assertThat(packer.packToLong(_4, _2)).isEqualTo(packer.packToLong(EnumSet.of(_4, _2)));
        assertThat(packer.packToLongInexact(_4, _2)).isEqualTo(packer.packToLongInexact(EnumSet.of(_4, _2)));
    }

    @Test
    public void packToByteTest() throws Exception {
        assertThat(
                EnumSetPacker.of(ByteEnum.class).packToByte(EnumSet.allOf(ByteEnum.class))
        ).isEqualTo((byte) -1);

{'fraction_non_alphanumeric': 0.12668840242198418, 'fraction_numerical': 0.0815090824406148, 'mean_word_length': 3.1337824831568817, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3835580', 'n_tokens_mistral': 1780, 'n_tokens_neox': 1552, 'n_words': 270}