<commit_before>import datastructures.SkipList;
import tools.Utilities;

public class SkipListTest {
    static SkipList sList;
    public static void main(String[] args) throws Exception {
        for (int i = 0; i < 5; i ++)
            testSimpleUniqueInsertion(50 + ((int) (Math.random() * 50)));
    }

    private static void testSimpleUniqueInsertion(int length) throws Exception {
        System.out.printf("\tTestSimpleUniqueInsertion (n = %d)\n", length);
        SkipList list = new SkipList();
        boolean[] visited = new boolean[1024];
        for (int i = 0; i < length; i ++) {
            // Find a unique element to insert.
            int value;
            do {
                value = (int) (Math.random() * 100) + 1;
            } while (visited[value]);
            visited[value] = true;

            list.add(value);
        }

        int[] array = list.toArray();

        for (int i = 0; i < array.length - 1; i ++) {
            if (array[i] >= array[i + 1]) throw new Exception(String.format("Invalid sorted order: %s", Utilities.toString(array)));
        }
    }
}<commit_msg>Add unique find test<commit_after>import datastructures.SkipList;
import tools.Utilities;

public class SkipListTest {
    static SkipList sList;
    public static void main(String[] args) throws Exception {
        for (int i = 0; i < 5; i ++)
            testSimpleUniqueInsertion(50 + ((int) (Math.random() * 50)));
        testUniqueFind();
    }

    private static void testSimpleUniqueInsertion(int length) throws Exception {
        System.out.printf("\tTestSimpleUniqueInsertion (n = %d)\n", length);
        SkipList list = new SkipList();
        boolean[] visited = new boolean[1024];
        addToList(list, length, visited);

        int[] array = list.toArray();

        for (int i = 0; i < array.length - 1; i ++) {
            if (array[i] >= array[i + 1]) throw new Exception(String.format("Invalid sorted order: %s", Utilities.toString(array)));
        }
    }

    private static void testUniqueFind() throws Exception {
        System.out.println("\tTestUniqueFind");
        SkipList list = new SkipList();
        boolean[] visited = new boolean[4096];
        addToList(list, visited.length / 2, visited);

        for (int i = 0; i < visited.length; i ++) {
            if (visited[i] && !list.find(i)) throw new Exception("Element not found in SkipList");
        }
    }

    private static void addToList(SkipList list, int numOfElements, boolean[] visited) throws Exception {
        for (int i = 0; i < numOfElements; i ++) {
            // Find a unique element to insert.
            int value;
            do {
                value = (int) (Math.random() * numOfElements) + 1;
            } while (visited[value]);
            visited[value] = true;

            list.add(value);
        }

    }
}
{'fraction_non_alphanumeric': 0.1290436005625879, 'fraction_numerical': 0.013713080168776372, 'mean_word_length': 2.2292849035187285, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 5, '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': '637990', 'n_tokens_mistral': 849, 'n_tokens_neox': 802, 'n_words': 244}