<commit_before>/**
 * 
 */
package org.perfidix.example;

import static org.junit.Assert.assertEquals;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

/**
 * @author <NAME>, University of Konstanz
 *
 */
public class FastIntStackTest
{

    private FastIntStack stack;
    private static int[] r = new int[5];
    /**
     * Create array with raandom integer values
     */
    @BeforeClass
    public static void initR()
    {
        java.util.Random random = new java.util.Random();
        for(int i=0;i<r.length;i++)
        {
            r[i] = random.nextInt();
        }
    }
    /**
     * @throws java.lang.Exception
     */
    @Before
    public void setUp() throws Exception
    {
        stack = new FastIntStack();
    }

    /**
     * Test method for {@link org.perfidix.example.FastIntStack#push(int)}., {@link org.perfidix.example.FastIntStack#get(int)}., {@link org.perfidix.example.FastIntStack#peek()}. and {@link org.perfidix.example.FastIntStack#pop()}.
     */
    @Test
    public void testPushSizeGetPeekPop()
    {
        assertEquals("Stack should be empty", 0, stack.size());
        for(int i=0;i<r.length;i++)
        {
            stack.push(r[i]);
        }
        assertEquals("Size of stack is r.length", r.length, stack.size());
        for(int i=r.length-1;i>=0;i--)
        {
            assertEquals("element i from stack is returned", r[i]
                    , stack.get(i));
            assertEquals("Stack element contains r[i]", r[i], stack.peek());
            assertEquals("Element r[i] is removed from stack", r[i], stack.pop());
        }
    }

        /**
     * Test method for {@link org.perfidix.example.FastIntStack#clear()}.
     */
    @Test
    public void testClear()
    {
        for(int i=0;i<r.length;i++)
        {
            stack.push(r[i]);
        }
        assertEquals("Size of stack is r.length", r.length, stack.size());<commit_msg>Added Constant to define data size<commit_after>/**
 * 
 */
package org.perfidix.example;

import static org.junit.Assert.assertEquals;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

/**
 * @author <NAME>, University of Konstanz
 * This is a class that tests the {@link FastIntStack} class with all its methods
 */
public class FastIntStackTest
{

    /**
     * This member variable contains a FastIntStack object.
     */
    private FastIntStack stack;
    /**
     * Create constant to determine size of test data
     */
    private static final int SIZE = 5;
    /**
     * This integer array contains five random values to test FastIntStack methods
     */
    private static int[] r = new int[SIZE];
    /**
     * Fill integer array with raandom values
     */
    @BeforeClass
    public static void initR()
    {
        java.util.Random random = new java.util.Random();
        for(int i=0;i<SIZE;i++)
        {
            r[i] = random.nextInt();
        }
    }
    /**
     * @throws java.lang.Exception
     */
    /**
     * initialize stack
     * @throws Exception
    */
    @Before
    public void setUp() throws Exception
    {
        stack = new FastIntStack();
    }

    /**
     * Test method for {@link org.perfidix.example.FastIntStack#push(int)}., {@link org.perfidix.example.FastIntStack#get(int)}., {@link org.perfidix.example.FastIntStack#peek()}. and {@link org.perfidix.example.FastIntStack#pop()}.
     */
    @Test
    public void testPushSizeGetPeekPop()
    {
        assertEquals("Stack should be empty", 0, stack.size());
        for(int i=0;i<SIZE;i++)
        {
            stack.push(r[i]);
        }
        assertEquals("Size of stack is "+ SIZE, SIZE, stack.size());
        for(int i=SIZE-1;i>=0;i--)
        {
            assertEquals("stack position is returned", r[i], stack.get(i));
            assertEquals("Stack element contains r[i]", r[i], stack.peek());
            assertEquals("Element r[i] is removed from stack", r[i], stack.pop());
        }
    }

        /**
     * Test method for {@link org.perfidix.example.FastIntStack#clear()}.
     */
    @Test
    public void testClear()
    {
        for(int i=0;i<SIZE;i++)
        {
            stack.push(r[i]);
        }
        assertEquals("Size of stack is "+ SIZE, SIZE, stack.size());
{'fraction_non_alphanumeric': 0.14319138979878335, 'fraction_numerical': 0.003275620028076743, 'mean_word_length': 2.2094594594594597, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, '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': '4823574', 'n_tokens_mistral': 1317, 'n_tokens_neox': 1297, 'n_words': 320}