<commit_before>package com.mikesamuel.cil.ast;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;

import org.junit.Test;

import com.google.common.base.Charsets;
import com.google.common.io.Files;
import com.google.common.io.Resources;
import com.mikesamuel.cil.parser.Input;

@SuppressWarnings("javadoc")
public final class SourceParsingSanityTest extends AbstractParSerTestCase {

  @Test
  public void testBaseNode() throws IOException {
    sanityCheckSourceFile("/com/mikesamuel/cil/ast/BaseNode.java");
  }

  @Test
  public void testLineStarts() throws IOException {
    sanityCheckSourceFile("/com/mikesamuel/cil/parser/LineStarts.java");
  }

  @Test
  public void testReference() throws IOException {
    sanityCheckSourceFile("/com/mikesamuel/cil/ptree/Reference.java");
  }

  @Test
  public void testTokens() throws IOException {
    sanityCheckSourceFile("/com/mikesamuel/cil/ptree/Tokens.java");
  }

  @Test
  public void testThemAll() throws Exception {
    long totalTime = 0;
    int nFiles = 0;
    for (String line : Resources.readLines(
            Resources.getResource(getClass(), "/all-sources.txt"),
            Charsets.UTF_8)) {
      setUp();
      File source = new File(line.trim());
      long t0 = System.nanoTime();
      boolean ok = false;
      try {
        parseSanityCheck(
            CompilationUnitNode.Variant
            .PackageDeclarationImportDeclarationTypeDeclaration,
            Input.builder()
            .source(source.getPath())
            .code(Files.asCharSource(source, Charsets.UTF_8))<commit_msg>run a subset of testThemAll under travis since it seems to timeout perhaps due to some surefire forked test timeout<commit_after>package com.mikesamuel.cil.ast;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.util.Collections;
import java.util.List;
import java.util.Locale;

import org.junit.Test;

import com.google.common.base.Charsets;
import com.google.common.collect.Lists;
import com.google.common.io.Files;
import com.google.common.io.Resources;
import com.mikesamuel.cil.parser.Input;

@SuppressWarnings("javadoc")
public final class SourceParsingSanityTest extends AbstractParSerTestCase {

  @Test
  public void testBaseNode() throws IOException {
    sanityCheckSourceFile("/com/mikesamuel/cil/ast/BaseNode.java");
  }

  @Test
  public void testLineStarts() throws IOException {
    sanityCheckSourceFile("/com/mikesamuel/cil/parser/LineStarts.java");
  }

  @Test
  public void testReference() throws IOException {
    sanityCheckSourceFile("/com/mikesamuel/cil/ptree/Reference.java");
  }

  @Test
  public void testTokens() throws IOException {
    sanityCheckSourceFile("/com/mikesamuel/cil/ptree/Tokens.java");
  }

  @Test
  public void testThemAll() throws Exception {
    long totalTime = 0;
    int nFiles = 0;
    List<File> sources = Lists.newArrayList();
    for (String line : Resources.readLines(
        Resources.getResource(getClass(), "/all-sources.txt"),
        Charsets.UTF_8)) {
      File source = new File(line.trim());
      sources.add(source);
    }

    if ("true".equalsIgnoreCase(System.getenv("TRAVIS"))) {
      // Don't cause Travis test running to time out.
      Collections.shuffle(sources);
      sources.subList(50, sources.size()).clear();
    }

    for (File source : sources) {
      setUp();
      long t0 = System.nanoTime();
      boolean ok = false;
      try {
        parseSanityCheck(
            CompilationUnitNode.Variant
            .PackageDeclarationImportDeclarationTypeDeclaration,
            Input.builder()
            .source(source.getPath())
            .code(Files.asCharSource(source, Charsets.UTF_8))
{'fraction_non_alphanumeric': 0.11170071637039003, 'fraction_numerical': 0.003183868400106129, 'mean_word_length': 3.451003541912633, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '3633239', 'n_tokens_mistral': 1142, 'n_tokens_neox': 1132, 'n_words': 233}