<commit_before>package yokohama.unit;

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.net.URI;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.cli.BasicParser;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.ParseException;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import org.junit.Test;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import yokohama.unit.translator.DocyCompiler;

public class MainTest {
    
    @Test
    public void testExtractOptions() throws ParseException {
        String[] args = {};
        List<Option> options = Arrays.asList(new BasicParser().parse(Main.constructOptions(), args).getOptions());
        List<String> delegatedOptions = Arrays.asList();
        List<String> actual = Main.extractOptions(options, delegatedOptions);
        List<String> expected = Arrays.asList();
        assertThat(actual, is(expected));
    }

    @Test
    public void testExtractOptions1() throws ParseException {
        String[] args = {"-d", ".", "-target", "1.8"};
        List<Option> options = Arrays.asList(new BasicParser().parse(Main.constructOptions(), args).getOptions());
        List<String> delegatedOptions = Arrays.asList();
        List<String> actual = Main.extractOptions(options, delegatedOptions);
        List<String> expected = Arrays.asList();
        assertThat(actual, is(expected));
    }

    @Test
    public void testExtractOptions2() throws ParseException {
        String[] args = {};
        List<Option> options = Arrays.asList(new BasicParser().parse(Main.constructOptions(), args).getOptions());
        List<String> delegatedOptions = Arrays.asList("d",  "target");
        List<String> actual = Main.extractOptions(options, delegatedOptions);
        List<String> expected = Arrays.asList();
        assertThat(actual, is(expected));
    }

    @Test
    public void testExtractOptions3() throws ParseException {
        String[] args = {"-d", ".", "-encoding", "UTF-8", "-nowarn", "-target", "1.8"};
        List<Option> options = Arrays.asList(new BasicParser().parse(Main.constructOptions(), args).getOptions());
        List<String> delegatedOptions = Arrays.asList("nowarn", "verbose", "d",  "target");
        List<String> actual = Main.extractOptions(options, delegatedOptions);
        List<String> expected = Arrays.asList("-d", ".", "-nowarn", "-target", "1.8");
        assertThat(actual, is(expected));
    }

    @Test
    public void testRun() {
        String[] args = { "-help" };
        DocyCompiler compiler = mock(DocyCompiler.class);
        InputStream in = mock(InputStream.class);
        PrintStream out = mock(PrintStream.class);
        PrintStream err = mock(PrintStream.class);
        int actual = new Main(compiler).run(in, out, err, args);
        int expected = Command.EXIT_SUCCESS;
        assertThat(actual, is(expected));
    }

    @Test
    public void testRun0() {
        String[] args = {};
        DocyCompiler compiler = mock(DocyCompiler.class);
        InputStream in = mock(InputStream.class);
        PrintStream out = mock(PrintStream.class);
        PrintStream err = mock(PrintStream.class);
        int actual = new Main(compiler).run(in, out, err, args);
        int expected = Command.EXIT_SUCCESS;
        assertThat(actual, is(expected));
    }

    @Test
    public void testRun1() {
        String[] args = { "-d" };
        DocyCompiler compiler = mock(DocyCompiler.class);
        InputStream in = mock(InputStream.class);
        PrintStream out = mock(PrintStream.class);
        PrintStream err = mock(PrintStream.class);
        int actual = new Main(compiler).run(in, out, err, args);
        int expected = Command.EXIT_FAILURE;
        assertThat(actual, is(expected));
    }

    @Test
    public void testRun2() {
        String[] args = { "-xxxxxx" };
        DocyCompiler compiler = mock(DocyCompiler.class);
        InputStream in = mock(InputStream.class);
        PrintStream out = mock(PrintStream.class);
        PrintStream err = mock(PrintStream.class);
        int actual = new Main(compiler).run(in, out, err, args);
        int expected = Command.EXIT_FAILURE;
        assertThat(actual, is(expected));
    }

    @Test
    public void testRun3() throws IOException {
        String[] args = { "-basedir", "E:\\src\\main", "E:\\src\\main\\yokohama\\unit\\Foo.docy"};
        DocyCompiler compiler = mock(DocyCompiler.class);
        when(compiler.compile(anyObject(), anyObject(), anyObject(), anyObject()))
                .thenReturn(true);
        InputStream in = mock(InputStream.class);
        PrintStream out = mock(PrintStream.class);
        PrintStream err = mock(PrintStream.class);
        int actual = new Main(compiler).run(in, out, err, args);
        int expected = Command.EXIT_SUCCESS;
        assertThat(actual, is(expected));
        verify(compiler).compile(anyObject(), eq("Foo"), eq("yokohama.unit"), eq(Arrays.asList()));
    }

    @Test
    public void testRun4() throws IOException {
        String[] args = { "-basedir", "E:\\src\\main\\", "E:\\src\\main\\yokohama\\unit\\Foo.docy"};
        DocyCompiler compiler = mock(DocyCompiler.class);
        when(compiler.compile(anyObject(), anyObject(), anyObject(), anyObject()))
                .thenReturn(true);
        InputStream in = mock(InputStream.class);
        PrintStream out = mock(PrintStream.class);
        PrintStream err = mock(PrintStream.class);
        int actual = new Main(compiler).run(in, out, err, args);
        int expected = Command.EXIT_SUCCESS;
        assertThat(actual, is(expected));
        verify(compiler).compile(anyObject(), eq("Foo"), eq("yokohama.unit"), eq(Arrays.asList()));
    }

    @Test
    public void testRun5() throws IOException {
        String[] args = { "-basedir", "/home/user/src/main", "/home/user/src/main/yokohama/unit/Foo.docy"};
        DocyCompiler compiler = mock(DocyCompiler.class);
        when(compiler.compile(anyObject(), anyObject(), anyObject(), anyObject()))
                .thenReturn(true);
        InputStream in = mock(InputStream.class);
        PrintStream out = mock(PrintStream.class);
        PrintStream err = mock(PrintStream.class);
        int actual = new Main(compiler).run(in, out, err, args);
        int expected = Command.EXIT_SUCCESS;
        assertThat(actual, is(expected));
        verify(compiler).compile(anyObject(), eq("Foo"), eq("yokohama.unit"), eq(Arrays.asList()));
    }

    @Test
    public void testRun6() throws IOException {
        String[] args = { "-basedir", "/home/user/src/main/", "/home/user/src/main/yokohama/unit/Foo.docy"};
        DocyCompiler compiler = mock(DocyCompiler.class);
        when(compiler.compile(anyObject(), anyObject(), anyObject(), anyObject()))
                .thenReturn(true);
        InputStream in = mock(InputStream.class);
        PrintStream out = mock(PrintStream.class);
        PrintStream err = mock(PrintStream.class);
        int actual = new Main(compiler).run(in, out, err, args);
        int expected = Command.EXIT_SUCCESS;
        assertThat(actual, is(expected));
        verify(compiler).compile(anyObject(), eq("Foo"), eq("yokohama.unit"), eq(Arrays.asList()));
    }

}<commit_msg>Fix: Specify Windows-only tests and Linux-only tests<commit_after>package yokohama.unit;

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.net.URI;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.cli.BasicParser;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.ParseException;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeTrue;
import org.junit.Test;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import yokohama.unit.translator.DocyCompiler;

public class MainTest {
    
    @Test
    public void testExtractOptions() throws ParseException {
        String[] args = {};
        List<Option> options = Arrays.asList(new BasicParser().parse(Main.constructOptions(), args).getOptions());
        List<String> delegatedOptions = Arrays.asList();
        List<String> actual = Main.extractOptions(options, delegatedOptions);
        List<String> expected = Arrays.asList();
        assertThat(actual, is(expected));
    }

    @Test
    public void testExtractOptions1() throws ParseException {
        String[] args = {"-d", ".", "-target", "1.8"};
        List<Option> options = Arrays.asList(new BasicParser().parse(Main.constructOptions(), args).getOptions());
        List<String> delegatedOptions = Arrays.asList();
        List<String> actual = Main.extractOptions(options, delegatedOptions);
        List<String> expected = Arrays.asList();
        assertThat(actual, is(expected));
    }

    @Test
    public void testExtractOptions2() throws ParseException {
        String[] args = {};
        List<Option> options = Arrays.asList(new BasicParser().parse(Main.constructOptions(), args).getOptions());
        List<String> delegatedOptions = Arrays.asList("d",  "target");
        List<String> actual = Main.extractOptions(options, delegatedOptions);
        List<String> expected = Arrays.asList();
        assertThat(actual, is(expected));
    }

    @Test
    public void testExtractOptions3() throws ParseException {
        String[] args = {"-d", ".", "-encoding", "UTF-8", "-nowarn", "-target", "1.8"};
        List<Option> options = Arrays.asList(new BasicParser().parse(Main.constructOptions(), args).getOptions());
        List<String> delegatedOptions = Arrays.asList("nowarn", "verbose", "d",  "target");
        List<String> actual = Main.extractOptions(options, delegatedOptions);
        List<String> expected = Arrays.asList("-d", ".", "-nowarn", "-target", "1.8");
        assertThat(actual, is(expected));
    }

    @Test
    public void testRun() {
        String[] args = { "-help" };
        DocyCompiler compiler = mock(DocyCompiler.class);
        InputStream in = mock(InputStream.class);
        PrintStream out = mock(PrintStream.class);
        PrintStream err = mock(PrintStream.class);
        int actual = new Main(compiler).run(in, out, err, args);
        int expected = Command.EXIT_SUCCESS;
        assertThat(actual, is(expected));
    }

    @Test
    public void testRun0() {
        String[] args = {};
        DocyCompiler compiler = mock(DocyCompiler.class);
        InputStream in = mock(InputStream.class);
        PrintStream out = mock(PrintStream.class);
        PrintStream err = mock(PrintStream.class);
        int actual = new Main(compiler).run(in, out, err, args);
        int expected = Command.EXIT_SUCCESS;
        assertThat(actual, is(expected));
    }

    @Test
    public void testRun1() {
        String[] args = { "-d" };
        DocyCompiler compiler = mock(DocyCompiler.class);
        InputStream in = mock(InputStream.class);
        PrintStream out = mock(PrintStream.class);
        PrintStream err = mock(PrintStream.class);
        int actual = new Main(compiler).run(in, out, err, args);
        int expected = Command.EXIT_FAILURE;
        assertThat(actual, is(expected));
    }

    @Test
    public void testRun2() {
        String[] args = { "-xxxxxx" };
        DocyCompiler compiler = mock(DocyCompiler.class);
        InputStream in = mock(InputStream.class);
        PrintStream out = mock(PrintStream.class);
        PrintStream err = mock(PrintStream.class);
        int actual = new Main(compiler).run(in, out, err, args);
        int expected = Command.EXIT_FAILURE;
        assertThat(actual, is(expected));
    }

    @Test
    public void testRun3() throws IOException {
        assumeTrue(System.getProperty("os.name").contains("Windows"));
        String[] args = { "-basedir", "E:\\src\\main", "E:\\src\\main\\yokohama\\unit\\Foo.docy"};
        DocyCompiler compiler = mock(DocyCompiler.class);
        when(compiler.compile(anyObject(), anyObject(), anyObject(), anyObject()))
                .thenReturn(true);
        InputStream in = mock(InputStream.class);
        PrintStream out = mock(PrintStream.class);
        PrintStream err = mock(PrintStream.class);
        int actual = new Main(compiler).run(in, out, err, args);
        int expected = Command.EXIT_SUCCESS;
        assertThat(actual, is(expected));
        verify(compiler).compile(anyObject(), eq("Foo"), eq("yokohama.unit"), eq(Arrays.asList()));
    }

    @Test
    public void testRun4() throws IOException {
        assumeTrue(System.getProperty("os.name").contains("Windows"));
        String[] args = { "-basedir", "E:\\src\\main\\", "E:\\src\\main\\yokohama\\unit\\Foo.docy"};
        DocyCompiler compiler = mock(DocyCompiler.class);
        when(compiler.compile(anyObject(), anyObject(), anyObject(), anyObject()))
                .thenReturn(true);
        InputStream in = mock(InputStream.class);
        PrintStream out = mock(PrintStream.class);
        PrintStream err = mock(PrintStream.class);
        int actual = new Main(compiler).run(in, out, err, args);
        int expected = Command.EXIT_SUCCESS;
        assertThat(actual, is(expected));
        verify(compiler).compile(anyObject(), eq("Foo"), eq("yokohama.unit"), eq(Arrays.asList()));
    }

    @Test
    public void testRun5() throws IOException {
        assumeTrue(System.getProperty("os.name").contains("Linux"));
        String[] args = { "-basedir", "/home/user/src/main", "/home/user/src/main/yokohama/unit/Foo.docy"};
        DocyCompiler compiler = mock(DocyCompiler.class);
        when(compiler.compile(anyObject(), anyObject(), anyObject(), anyObject()))
                .thenReturn(true);
        InputStream in = mock(InputStream.class);
        PrintStream out = mock(PrintStream.class);
        PrintStream err = mock(PrintStream.class);
        int actual = new Main(compiler).run(in, out, err, args);
        int expected = Command.EXIT_SUCCESS;
        assertThat(actual, is(expected));
        verify(compiler).compile(anyObject(), eq("Foo"), eq("yokohama.unit"), eq(Arrays.asList()));
    }

    @Test
    public void testRun6() throws IOException {
        assumeTrue(System.getProperty("os.name").contains("Linux"));
        String[] args = { "-basedir", "/home/user/src/main/", "/home/user/src/main/yokohama/unit/Foo.docy"};
        DocyCompiler compiler = mock(DocyCompiler.class);
        when(compiler.compile(anyObject(), anyObject(), anyObject(), anyObject()))
                .thenReturn(true);
        InputStream in = mock(InputStream.class);
        PrintStream out = mock(PrintStream.class);
        PrintStream err = mock(PrintStream.class);
        int actual = new Main(compiler).run(in, out, err, args);
        int expected = Command.EXIT_SUCCESS;
        assertThat(actual, is(expected));
        verify(compiler).compile(anyObject(), eq("Foo"), eq("yokohama.unit"), eq(Arrays.asList()));
    }

}
{'fraction_non_alphanumeric': 0.14422700587084147, 'fraction_numerical': 0.002217873450750163, 'mean_word_length': 3.164900842162456, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, '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': '5205030', 'n_tokens_mistral': 4367, 'n_tokens_neox': 4358, 'n_words': 943}