<commit_before>package org.github.scr.hashmap;

import gnu.trove.map.TObjectIntMap;
import gnu.trove.map.hash.TObjectIntHashMap;
import org.github.scr.hashmap.maps.BufferCharSequenceMap;
import org.github.scr.hashmap.maps.BufferCharSequenceMaps;
import org.testng.annotations.Test;

import java.io.BufferedReader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.github.scr.hashmap.TestConstants.TARGET_PATH;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;

/**
 * Created by scr on 7/3/15.
 */
@Test
public class BigFileTimingTest {
    private static final Path WORDS_PATH = Paths.get("/usr/share/dict/words");
    private static final Path WORDS_BIN_PATH = TARGET_PATH.resolve("words.bin");
    private static final String KEY1 = "scientificophilosophical";
    private static final int TIMES = 1000000;

    private static final long NUM_LINES = 235886L;


    private List<String> lines;
    private BufferCharSequenceMap<Integer> bufferedMap;
    private TObjectIntMap<String> troveMap = new TObjectIntHashMap<>();
    private Map<String, Integer> regularMap = new HashMap<>();

    @Test
    public void testReadAllLines() throws Exception {
        lines = Files.readAllLines(WORDS_PATH);
        assertThat(lines.size(), is((int) NUM_LINES));
    }

    @Test
    public void testReadStreamLines() throws Exception {
        try (BufferedReader input = Files.newBufferedReader(WORDS_PATH)) {
            assertThat(input.lines().count(), is(NUM_LINES));
        }
    }

    @Test(dependsOnMethods = "testReadAllLines")
    public void testLoadTroveMap() throws Exception {
        int i = 0;
        for (String line : lines) {
            troveMap.put(line, ++i);
        }
    }

    @Test(dependsOnMethods = "testReadAllLines")<commit_msg>Don't verify numlines on the words dict; just that it's non-zero.<commit_after>package org.github.scr.hashmap;

import gnu.trove.map.TObjectIntMap;
import gnu.trove.map.hash.TObjectIntHashMap;
import org.github.scr.hashmap.maps.BufferCharSequenceMap;
import org.github.scr.hashmap.maps.BufferCharSequenceMaps;
import org.testng.annotations.Test;

import java.io.BufferedReader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.github.scr.hashmap.TestConstants.TARGET_PATH;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;

/**
 * Created by scr on 7/3/15.
 */
@Test
public class BigFileTimingTest {
    private static final Path WORDS_PATH = Paths.get("/usr/share/dict/words");
    private static final Path WORDS_BIN_PATH = TARGET_PATH.resolve("words.bin");
    private static final String KEY1 = "scientificophilosophical";
    private static final int TIMES = 1000000;

    private List<String> lines;
    private BufferCharSequenceMap<Integer> bufferedMap;
    private TObjectIntMap<String> troveMap = new TObjectIntHashMap<>();
    private Map<String, Integer> regularMap = new HashMap<>();

    @Test
    public void testReadAllLines() throws Exception {
        lines = Files.readAllLines(WORDS_PATH);
        assertThat(lines.size(), not(is(0L)));
    }

    @Test
    public void testReadStreamLines() throws Exception {
        try (BufferedReader input = Files.newBufferedReader(WORDS_PATH)) {
            assertThat(lines.size(), not(is(0L)));
        }
    }

    @Test(dependsOnMethods = "testReadAllLines")
    public void testLoadTroveMap() throws Exception {
        int i = 0;
        for (String line : lines) {
            troveMap.put(line, ++i);
        }
    }

    @Test(dependsOnMethods = "testReadAllLines")
{'fraction_non_alphanumeric': 0.10919540229885058, 'fraction_numerical': 0.008881922675026124, 'mean_word_length': 3.8468354430379748, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '5525235', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1169, 'n_words': 266}