<commit_before>package teetime.stage;

import static teetime.framework.test.StageTester.test;

import java.util.ArrayList;
import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import teetime.framework.DivideAndConquerStage;
import teetime.stage.quicksort.QuicksortProblem;
import teetime.stage.quicksort.QuicksortSolution;

/**
 * @author <NAME>
 */
public class ExtendedDivideAndConquerStageTest {
	DivideAndConquerStage<QuicksortProblem, QuicksortSolution> quicksortStage;
	List<QuicksortSolution> solutions;
	List<QuicksortProblem> problems;

	private QuicksortProblem problemOne;
	private QuicksortProblem problemTwo;
	QuicksortProblem problemThree;

	@Before
	public void initialize() {
		quicksortStage = new DivideAndConquerStage<QuicksortProblem, QuicksortSolution>();

		int[] firstInts = { 3, 8, 4, 2, 1, 9, 5, 10, 7, 6 };
		int[] secondInts = { 2, 4, 3, 1, 5 };
		int[] thirdInts = { 4, 3, 3, 4, 2, 4, 1, 2, 3, 4 };

		problemOne = new QuicksortProblem(1, 0, firstInts.length - 1, firstInts);
		problemTwo = new QuicksortProblem(2, 0, secondInts.length - 1, secondInts);
		problemThree = new QuicksortProblem(3, 0, thirdInts.length - 1, thirdInts);

		problems = new ArrayList<QuicksortProblem>();
		problems.add(problemOne);
		problems.add(problemTwo);
		problems.add(problemThree);

		solutions = new ArrayList<QuicksortSolution>();
	}

	@Test
	public void quicksortImplementationShouldSortArray() {
		test(this.quicksortStage).and()
				.send(problems).to(quicksortStage.getInputPort()).and()
				.receive(solutions).from(quicksortStage.getOutputPort())
				.start();
	}

	@After
	public void evaluate() {
		int[] firstSortedInts = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
		int[] secondSortedInts = { 1, 2, 3, 4, 5 };
		int[] thirdSortedInts = { 1, 2, 2, 3, 3, 3, 4, 4, 4, 4 };
		System.out.println(solutions.get(0).toString());
		System.out.println(solutions.get(1).toString());
		System.out.println(solutions.get(2).toString());
		// FIXME Problem: Solution output order not guaranteed
		// assertArrayEquals(solutions.get(0).getNumbers(), firstSortedInts);
		// assertArrayEquals(solutions.get(1).getNumbers(), secondSortedInts);
		// assertArrayEquals(solutions.get(2).getNumbers(), thirdSortedInts);

	}
}
<commit_msg>rewrote test<commit_after>package teetime.stage;

import static org.junit.Assert.assertTrue;
import static teetime.framework.test.StageTester.test;

import java.util.ArrayList;
import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import teetime.framework.DivideAndConquerStage;
import teetime.stage.quicksort.QuicksortProblem;
import teetime.stage.quicksort.QuicksortSolution;

/**
 * @author <NAME>
 */
public class ExtendedDivideAndConquerStageTest {
	DivideAndConquerStage<QuicksortProblem, QuicksortSolution> quicksortStage;
	List<QuicksortSolution> solutions;
	List<QuicksortProblem> problems;

	private QuicksortProblem problemOne;
	private QuicksortProblem problemTwo;
	QuicksortProblem problemThree;

	@Before
	public void initialize() {
		quicksortStage = new DivideAndConquerStage<QuicksortProblem, QuicksortSolution>();

		int[] firstInts = { 3, 8, 4, 2, 1, 9, 5, 10, 7, 6 };
		int[] secondInts = { 2, 4, 3, 1, 5 };
		int[] thirdInts = { 4, 3, 3, 4, 2, 4, 1, 2, 3, 4 };

		problemOne = new QuicksortProblem(1, 0, firstInts.length - 1, firstInts);
		problemTwo = new QuicksortProblem(2, 0, secondInts.length - 1, secondInts);
		problemThree = new QuicksortProblem(3, 0, thirdInts.length - 1, thirdInts);

		problems = new ArrayList<QuicksortProblem>();
		problems.add(problemOne);
		problems.add(problemTwo);
		problems.add(problemThree);

		solutions = new ArrayList<QuicksortSolution>();
	}

	@Test
	public void quicksortImplementationShouldSortArray() {
		test(this.quicksortStage).and()
				.send(problems).to(quicksortStage.getInputPort()).and()
				.receive(solutions).from(quicksortStage.getOutputPort())
				.start();
	}

	@After
	public void evaluate() {
		assertTrue(isSorted(solutions.get(0).getNumbers()));
		assertTrue(isSorted(solutions.get(1).getNumbers()));
		assertTrue(isSorted(solutions.get(2).getNumbers()));

	}

	private boolean isSorted(final int[] ints) {
		for (int i = 1; i < ints.length; i++) {
			if (ints[i - 1] > ints[i]) {
				return false;
			}
		}
		return true;
	}
}

{'fraction_non_alphanumeric': 0.13097898971837282, 'fraction_numerical': 0.023915958873491284, 'mean_word_length': 4.258519388954172, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, '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': '2404635', 'n_tokens_mistral': 1774, 'n_tokens_neox': 1502, 'n_words': 318}