<commit_before>package edu.vu.isis.ammo.util;

import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Test;

/**
 * Test the basic functionality of the pretrie. The pretrie is a tree whose keys
 * are prefixes. When queried the pretrie returns the values having the longest
 * matching prefix.
 * <p>
 * When presented with a key the pretrie will select the longest of its matching
 * prefixes. A matching prefix is one which is a prefix to the supplied key.
 * 
 */
public class NaivePretrieTest {

	@Test
	public void basicPutAndGet() {
		final PrefixList<String> pretrie = new PrefixList<String>();
		pretrie.insert("abced", "abcde");
		pretrie.insert("abcd", "abcd");

		Assert.assertThat("just missed (no safetynet)",
				pretrie.longestPrefix("abc"), CoreMatchers.is("a"));

		pretrie.insert("a", "a");
		Assert.assertThat("just missed (with safetynet)",
				pretrie.longestPrefix("abc"), CoreMatchers.is("a"));

		Assert.assertThat("exact hit",
				pretrie.longestPrefix("abcd"),
				CoreMatchers.is("abcd"));

		Assert.assertThat("exact hit over",
				pretrie.longestPrefix("abcde"),
				CoreMatchers.is("abcde"));

		Assert.assertThat("over shoot",
				pretrie.longestPrefix("abcdef"),
				CoreMatchers.is("abcde"));
	}

}<commit_msg>working test for old pretrie<commit_after>package edu.vu.isis.ammo.util;

import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Test;

import edu.vu.isis.ammo.pretrie.Pretrie;

/**
 * Test the basic functionality of the pretrie. The pretrie is a tree whose keys
 * are prefixes. When queried the pretrie returns the values having the longest
 * matching prefix.
 * <p>
 * When presented with a key the pretrie will select the longest of its matching
 * prefixes. A matching prefix is one which is a prefix to the supplied key.
 * 
 */
public class NaivePretrieTest {

	@Test
	public void basicPutAndGet() {
		final PrefixList<String> pretrie = new PrefixList<String>();
		pretrie.insert("abcde", "abcde");
		pretrie.insert("abcdf", "abcdf");
		pretrie.insert("abc", "abc");

		Assert.assertThat("just missed (no safetynet)",
				pretrie.longestPrefix("ab"), CoreMatchers.nullValue());

		pretrie.insert("a", "a");
		Assert.assertThat("just missed (with safetynet)",
				pretrie.longestPrefix("ab"), CoreMatchers.is("a"));

		Assert.assertThat("exact hit",
				pretrie.longestPrefix("abc"),
				CoreMatchers.is("abc"));

		Assert.assertThat("exact hit over",
				pretrie.longestPrefix("abcde"),
				CoreMatchers.is("abcde"));

		Assert.assertThat("over shoot",
				pretrie.longestPrefix("abcdeg"),
				CoreMatchers.is("abcde"));
		
	}

}
{'fraction_non_alphanumeric': 0.13615560640732266, 'fraction_numerical': 0.0, 'mean_word_length': 4.522105263157894, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1463246', 'n_tokens_mistral': 929, 'n_tokens_neox': 834, 'n_words': 224}