<commit_before>package com.moandjiezana.toml;

import static java.util.Arrays.asList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.io.File;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.Scanner;
import java.util.TimeZone;

import org.junit.Test;
import org.parboiled.Parboiled;
import org.parboiled.parserunners.RecoveringParseRunner;
import org.parboiled.support.ParsingResult;

public class RealWorldTest {

  @SuppressWarnings("unchecked")
  @Test
  public void should_parse_example() throws Exception {
    TomlParser parser = Parboiled.createParser(TomlParser.class);

    String toml = new Scanner(new File(getClass().getResource("example.toml").getFile())).useDelimiter("\\Z").next();
    ParsingResult<Object> result = new RecoveringParseRunner<Object>(parser.Toml()).run(toml);

    Map<String, Object> root = (Map<String, Object>) result.valueStack.peek(result.valueStack.size() - 2);

    printMap(root);

    assertEquals("TOML Example", root.get("title"));

    Map<String, Object> owner = get(root, "owner");
    assertEquals("<NAME>", owner.get("name"));
    assertEquals("GitHub", owner.get("organization"));
    assertEquals("GitHub Cofounder & CEO\nLikes tater tots and beer.", owner.get("bio"));

    Calendar dob = Calendar.getInstance();
    dob.set(1979, Calendar.MAY, 27, 7, 32, 0);
    dob.set(Calendar.MILLISECOND, 0);
    dob.setTimeZone(TimeZone.getTimeZone("UTC"));
    assertEquals(dob.getTime(), owner.get("dob"));

    Map<String, Object> database = get(root, "database");
    assertEquals("192.168.1.1", database.get("server"));
    assertEquals(5000L, database.get("connection_max"));<commit_msg>Removed console logging<commit_after>package com.moandjiezana.toml;

import static java.util.Arrays.asList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.io.File;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.Scanner;
import java.util.TimeZone;

import org.junit.Test;
import org.parboiled.Parboiled;
import org.parboiled.parserunners.RecoveringParseRunner;
import org.parboiled.support.ParsingResult;

public class RealWorldTest {

  @SuppressWarnings("unchecked")
  @Test
  public void should_parse_example() throws Exception {
    TomlParser parser = Parboiled.createParser(TomlParser.class);

    String toml = new Scanner(new File(getClass().getResource("example.toml").getFile())).useDelimiter("\\Z").next();
    ParsingResult<Object> result = new RecoveringParseRunner<Object>(parser.Toml()).run(toml);

    Map<String, Object> root = (Map<String, Object>) result.valueStack.peek(result.valueStack.size() - 2);

    // printMap(root);

    assertEquals("TOML Example", root.get("title"));

    Map<String, Object> owner = get(root, "owner");
    assertEquals("<NAME>", owner.get("name"));
    assertEquals("GitHub", owner.get("organization"));
    assertEquals("GitHub Cofounder & CEO\nLikes tater tots and beer.", owner.get("bio"));

    Calendar dob = Calendar.getInstance();
    dob.set(1979, Calendar.MAY, 27, 7, 32, 0);
    dob.set(Calendar.MILLISECOND, 0);
    dob.setTimeZone(TimeZone.getTimeZone("UTC"));
    assertEquals(dob.getTime(), owner.get("dob"));

    Map<String, Object> database = get(root, "database");
    assertEquals("192.168.1.1", database.get("server"));
    assertEquals(5000L, database.get("connection_max"));
{'fraction_non_alphanumeric': 0.15202994529225453, 'fraction_numerical': 0.013820904117477686, 'mean_word_length': 5.293478260869565, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '4437330', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1096, 'n_words': 209}