<commit_before>package com.caseystella.analytics.outlier;

import com.caseystella.analytics.DataPoint;
import com.caseystella.analytics.timeseries.inmemory.InMemoryTimeSeriesDB;
import com.caseystella.analytics.distribution.SimpleTimeRange;
import org.junit.Assert;
import org.junit.Test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Random;

public class InMemoryTSDBTest {
    @Test
    public void testBasics() {
        try {
            InMemoryTimeSeriesDB tsdb = new InMemoryTimeSeriesDB();
            Random r = new Random(0);
            List<DataPoint> points = new ArrayList<>();
            for (int i = 0; i < 100; ++i) {
                double val = r.nextDouble() * 1000;
                DataPoint dp = (new DataPoint(i, val, null, "foo"));
                tsdb.persist("test", dp, new HashMap<String, String>(), null);
                points.add(dp);
            }

            DataPoint evalPt = points.get(50);
            List<DataPoint> retrieved = tsdb.retrieve("test", evalPt, new SimpleTimeRange(0, 100), new HashMap<String, String>());
            int i = 0;
            Assert.assertEquals(retrieved.size(), 50);
            for (DataPoint foundPt : retrieved) {
                Assert.assertEquals(foundPt, points.get(i++));
            }
        }
        finally {
            InMemoryTimeSeriesDB.clear();
        }
    }
}
<commit_msg>making things a bit more tolerant.<commit_after>package com.caseystella.analytics.outlier;

import com.caseystella.analytics.DataPoint;
import com.caseystella.analytics.timeseries.inmemory.InMemoryTimeSeriesDB;
import com.caseystella.analytics.distribution.SimpleTimeRange;
import org.junit.Assert;
import org.junit.Test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Random;

public class InMemoryTSDBTest {
    @Test
    public void testBasics() {
        try {
            InMemoryTimeSeriesDB tsdb = new InMemoryTimeSeriesDB();
            Random r = new Random(0);
            List<DataPoint> points = new ArrayList<>();
            for (int i = 0; i < 100; ++i) {
                double val = r.nextDouble() * 1000;
                DataPoint dp = (new DataPoint(i, val, null, "foo"));
                tsdb.persist("test", dp, new HashMap<String, String>(), null);
                points.add(dp);
            }

            DataPoint evalPt = points.get(50);
            List<DataPoint> retrieved = tsdb.retrieve("test", evalPt, new SimpleTimeRange(0, 100), new HashMap<String, String>(), -1);
            int i = 0;
            Assert.assertEquals(retrieved.size(), 50);
            for (DataPoint foundPt : retrieved) {
                Assert.assertEquals(foundPt, points.get(i++));
            }
        }
        finally {
            InMemoryTimeSeriesDB.clear();
        }
    }
}

{'fraction_non_alphanumeric': 0.11725586279313965, 'fraction_numerical': 0.01295064753237662, 'mean_word_length': 2.3348891481913654, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, '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': '3837724', 'n_tokens_mistral': 864, 'n_tokens_neox': 816, 'n_words': 188}