<commit_before>package stsc.general.statistic.cost.function;

import java.text.ParseException;

import stsc.common.Settings;
import stsc.general.statistic.Statistics;
import stsc.general.testhelper.TestStatisticsHelper;
import junit.framework.TestCase;

public class CostLexicographicalFunctionTest extends TestCase {
	public void testLexicographicalCostFunction() throws ParseException {
		final Statistics statistics = TestStatisticsHelper.getStatistics();

		final CostLexicographicalFunction c10 = new CostLexicographicalFunction();
		c10.addNextValue("getPeriod");
		c10.addNextValue("getAvGain");
		final Double c10result = c10.calculate(statistics);
		assertEquals(20.246987, c10result, Settings.doubleEpsilon);
	}

	public void testLexicographicalCostFunction100() throws ParseException {
		final Statistics statistics = TestStatisticsHelper.getStatistics();

		final CostLexicographicalFunction c100 = new CostLexicographicalFunction(100);
		c100.addNextValue("getPeriod");
		c100.addNextValue("getAvGain");
		c100.addNextValue("getAvGain");
		final Double c100result = c100.calculate(statistics);
		assertEquals(20024.9456978, c100result, Settings.doubleEpsilon);
	}

	public void testLexicographicalCostFunctionAnotherOrder() throws ParseException {
		final Statistics statistics = TestStatisticsHelper.getStatistics();

		final CostLexicographicalFunction c10 = new CostLexicographicalFunction();
		c10.addNextValue("getAvGain");
		c10.addNextValue("getPeriod");
		final Double c10result = c10.calculate(statistics);
		assertEquals(4.469871, c10result, Settings.doubleEpsilon);
	}
}<commit_msg>#85 fixed CostLexicographicalFunctionTest<commit_after>package stsc.general.statistic.cost.function;

import java.text.ParseException;

import stsc.common.Settings;
import stsc.general.statistic.Statistics;
import stsc.general.testhelper.TestStatisticsHelper;
import junit.framework.TestCase;

public class CostLexicographicalFunctionTest extends TestCase {
	public void testLexicographicalCostFunction() throws ParseException {
		final Statistics statistics = TestStatisticsHelper.getStatistics();

		final CostLexicographicalFunction c10 = new CostLexicographicalFunction();
		c10.addNextValue("getPeriod");
		c10.addNextValue("getAvGain");
		final Double c10result = c10.calculate(statistics);
		assertEquals(19.757116, c10result, Settings.doubleEpsilon);
	}

	public void testLexicographicalCostFunction100() throws ParseException {
		final Statistics statistics = TestStatisticsHelper.getStatistics();

		final CostLexicographicalFunction c100 = new CostLexicographicalFunction(100);
		c100.addNextValue("getPeriod");
		c100.addNextValue("getAvGain");
		c100.addNextValue("getAvGain");
		final Double c100result = c100.calculate(statistics);
		assertEquals(19975.468730, c100result, Settings.doubleEpsilon);
	}

	public void testLexicographicalCostFunctionAnotherOrder() throws ParseException {
		final Statistics statistics = TestStatisticsHelper.getStatistics();

		final CostLexicographicalFunction c10 = new CostLexicographicalFunction();
		c10.addNextValue("getAvGain");
		c10.addNextValue("getPeriod");
		final Double c10result = c10.calculate(statistics);
		assertEquals(-0.4288385, c10result, Settings.doubleEpsilon);
	}
}
{'fraction_non_alphanumeric': 0.08947855600123418, 'fraction_numerical': 0.04875038568343104, 'mean_word_length': 7.442708333333333, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6725920', 'n_tokens_mistral': 1065, 'n_tokens_neox': 902, 'n_words': 176}