<commit_before>package io.nti.parse.utils;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

import org.junit.Test;

import io.nti.parse.SimpleContext;
import io.nti.parse.Context;
import io.nti.parse.Parser;
import io.nti.parse.ParsingException;

import static io.nti.parse.utils.Parsers.*;
import static org.assertj.core.api.Assertions.*;

/**
 * @author <NAME>
 */
public class ParsersTest {

    @Test
    public void testSeq() throws ParsingException {
        final Context ctx = new SimpleContext("abcdefg");
        final String sequence = "abcd";
        final Parser<CharSequence> parser = seq(sequence);
        assertThat(parser.parse(ctx)).isEqualTo(sequence);
        assertThat(ctx.pos()).isEqualTo(sequence.length());
    }

    @Test
    public void testSeqToLong() {
        final Context ctx = new SimpleContext("abc");
        final String sequence = "abcd";
        final Parser<CharSequence> parser = seq(sequence);
        try {
            parser.parse(ctx);
            fail("Expected Exception");
        } catch (ParsingException e) {
            // No-Op
        }
        assertThat(ctx.pos()).isEqualTo(0);
    }

    @Test<commit_msg>Test other seq parser<commit_after>package io.nti.parse.utils;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

import org.junit.Test;

import io.nti.parse.SimpleContext;
import io.nti.parse.Context;
import io.nti.parse.Parser;
import io.nti.parse.ParsingException;

import static io.nti.parse.utils.Parsers.*;
import static org.assertj.core.api.Assertions.*;

/**
 * @author <NAME>
 */
public class ParsersTest {

    @Test
    public void testSeq() throws ParsingException {
        final Context ctx = new SimpleContext("abcdefg");
        final String sequence = "abcd";
        final Parser<CharSequence> parser = seq(sequence);
        assertThat(parser.parse(ctx)).isEqualTo(sequence);
        assertThat(ctx.pos()).isEqualTo(sequence.length());
    }

    @Test
    public void testOtherSeq() throws ParsingException {
        final Context ctx = new SimpleContext("abcdefg");
        final String sequence = "cbda";
        final Parser<CharSequence> parser = seq(any(sequence));
        assertThat(parser.parse(ctx)).isEqualTo("a");
        assertThat(ctx.pos()).isEqualTo(1);
    }

    @Test
    public void testSeqToLong() {
        final Context ctx = new SimpleContext("abc");
        final String sequence = "abcd";
        final Parser<CharSequence> parser = seq(sequence);
        try {
            parser.parse(ctx);
            fail("Expected Exception");
        } catch (ParsingException e) {
            // No-Op
        }
        assertThat(ctx.pos()).isEqualTo(0);
    }

    @Test
{'fraction_non_alphanumeric': 0.1253654970760234, 'fraction_numerical': 0.0010964912280701754, 'mean_word_length': 2.860366713681241, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, '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': '1882063', 'n_tokens_mistral': 796, 'n_tokens_neox': 804, 'n_words': 177}