<commit_before>
package jsprit.core.problem;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.util.Random;

import org.junit.Test;

public class CapacityTest {
	
	@Test
	public void whenSettingSimplyOneCapDimension_nuOfDimensionMustBeCorrect(){
		Capacity.Builder capBuilder = Capacity.Builder.newInstance();
		capBuilder.addDimension(0, 4);
		Capacity cap = capBuilder.build();
		assertEquals(1,cap.getNuOfDimensions());
	}
	
	@Test
	public void whenSettingTwoCapDimension_nuOfDimensionMustBeCorrect(){
		Capacity.Builder capBuilder = Capacity.Builder.newInstance();
		capBuilder.addDimension(0, 4);
		capBuilder.addDimension(1,10);
		Capacity cap = capBuilder.build();
		assertEquals(2,cap.getNuOfDimensions());
	}
	
	@Test
	public void whenSettingRandomNuOfCapDimension_nuOfDimensionMustBeCorrect(){
		Random rand = new Random();
		int nuOfCapDimensions = rand.nextInt(100);
		Capacity.Builder capBuilder = Capacity.Builder.newInstance();
		capBuilder.addDimension(nuOfCapDimensions-1, 4);
		Capacity cap = capBuilder.build();<commit_msg>modified test to avoid negative dimIndex<commit_after>
package jsprit.core.problem;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.util.Random;

import org.junit.Test;

public class CapacityTest {
	
	@Test
	public void whenSettingSimplyOneCapDimension_nuOfDimensionMustBeCorrect(){
		Capacity.Builder capBuilder = Capacity.Builder.newInstance();
		capBuilder.addDimension(0, 4);
		Capacity cap = capBuilder.build();
		assertEquals(1,cap.getNuOfDimensions());
	}
	
	@Test
	public void whenSettingTwoCapDimension_nuOfDimensionMustBeCorrect(){
		Capacity.Builder capBuilder = Capacity.Builder.newInstance();
		capBuilder.addDimension(0, 4);
		capBuilder.addDimension(1,10);
		Capacity cap = capBuilder.build();
		assertEquals(2,cap.getNuOfDimensions());
	}
	
	@Test
	public void whenSettingRandomNuOfCapDimension_nuOfDimensionMustBeCorrect(){
		Random rand = new Random();
		int nuOfCapDimensions = 1+rand.nextInt(100);
		Capacity.Builder capBuilder = Capacity.Builder.newInstance();
		capBuilder.addDimension(nuOfCapDimensions-1, 4);
		Capacity cap = capBuilder.build();
{'fraction_non_alphanumeric': 0.10368763557483732, 'fraction_numerical': 0.012581344902386117, 'mean_word_length': 6.251572327044025, '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': '3226964', 'n_tokens_mistral': 746, 'n_tokens_neox': 702, 'n_words': 134}