<commit_before>package stsc.common.collections;

import org.junit.Assert;
import org.junit.Test;

import com.google.common.collect.Ordering;

public class SortedByRatingTest {
	@Test
	public void testSortedByRating() {
		final SortedByRating<Integer> s = new SortedByRating<>(Ordering.natural());
		s.addElement(14.5, 15);
		s.addElement(14.5, 16);
		s.addElement(14.5, 17);
		s.addElement(14.5, 18);
		s.addElement(14.5, 19);
		s.addElement(14.5, 20);
		s.addElement(14.5, 21);
		Assert.assertEquals(7, s.size());
		s.deleteLast();
		Assert.assertEquals(6, s.size());
		Assert.assertEquals(20, s.getValuesAsList().get(5).intValue());
		s.addElement(14.6, 21);
		Assert.assertEquals(7, s.size());
		Assert.assertEquals(20, s.getValuesAsList().get(6).intValue());
		s.deleteLast();
		Assert.assertEquals(6, s.size());
		Assert.assertEquals(19, s.getValuesAsList().get(5).intValue());
		Assert.assertEquals(19, s.deleteLast().get().intValue());
		Assert.assertEquals(18, s.getValuesAsList().get(4).intValue());
		Assert.assertEquals(17, s.getValuesAsList().get(3).intValue());
		for (int i = 0; i < 20; ++i)
			s.deleteLast();
	}
}<commit_msg>improving SortedByRatingTest (added test with differnet keys)<commit_after>package stsc.common.collections;

import org.junit.Assert;
import org.junit.Test;

import com.google.common.collect.Ordering;

public class SortedByRatingTest {
	@Test
	public void testSortedByRating() {
		final SortedByRating<Integer> s = new SortedByRating<>(Ordering.natural());
		s.addElement(14.5, 15);
		s.addElement(14.5, 16);
		s.addElement(14.5, 17);
		s.addElement(14.5, 18);
		s.addElement(14.5, 19);
		s.addElement(14.5, 20);
		s.addElement(14.5, 21);
		Assert.assertEquals(7, s.size());
		s.deleteLast();
		Assert.assertEquals(6, s.size());
		Assert.assertEquals(20, s.getValuesAsList().get(5).intValue());
		s.addElement(14.6, 21);
		Assert.assertEquals(7, s.size());
		Assert.assertEquals(20, s.getValuesAsList().get(6).intValue());
		s.deleteLast();
		Assert.assertEquals(6, s.size());
		Assert.assertEquals(19, s.getValuesAsList().get(5).intValue());
		Assert.assertEquals(19, s.deleteLast().get().intValue());
		Assert.assertEquals(18, s.getValuesAsList().get(4).intValue());
		Assert.assertEquals(17, s.getValuesAsList().get(3).intValue());
		for (int i = 0; i < 20; ++i)
			s.deleteLast();
	}
	
	@Test
	public void testSortedWithSort() {
		final SortedByRating<Integer> s = new SortedByRating<>(Ordering.natural());
		s.addElement(2.0, 15);
		s.addElement(4.0, 16);
		s.addElement(6.0, 17);
		Assert.assertEquals(15, s.getValuesAsList().get(2).intValue());
		Assert.assertEquals(15, s.deleteLast().get().intValue());
		Assert.assertEquals(17, s.getValuesAsList().get(0).intValue());
	}
}
{'fraction_non_alphanumeric': 0.18949687844289387, 'fraction_numerical': 0.05435181784796181, 'mean_word_length': 5.148984198645598, 'pattern_counts': {'":': 0, '<': 11, '<?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': '6742405', 'n_tokens_mistral': 1137, 'n_tokens_neox': 993, 'n_words': 159}