<commit_before>package org.wallerlab.swy.service.energy;

import org.wallerlab.swy.model.SearchSpace
import spock.lang.*;

public class MathematicalFunctionTest extends Specification{

	private MathematicalFunction mathematicalFunction
	
	private SearchSpace searchSpace
	
	private double[] solution
	private double energy
	
	def "Test return values of the mathematical function." () {
		
		given:
		mathematicalFunction = new MathematicalFunction()
		searchSpace = new SearchSpace()
		searchSpace.startValues = [0.0, 0.0, 0.0]
		searchSpace.endValues = [2*Math.PI, 2*Math.PI, 2*Math.PI]
		mathematicalFunction.setSearchSpace(searchSpace)
		
		expect:
		mathematicalFunction.getEnergy(solution).round(4) == energy
		
		where:
		solution								|	energy
		[0.0, 0.0, 0.0]							|	-3.0
		[2*Math.PI, 2*Math.PI, 2*Math.PI]		|	-3.0
		[Math.PI, 0.0, 2*Math.PI]				|	-2.95
		[0.0, Math.PI, Math.PI]					|	-2.90
		[Math.PI, Math.PI, Math.PI]				|	-2.85
		[0.5*Math.PI, 0.5*Math.PI, 0.5*Math.PI]	|	0.1125
		
	}
}<commit_msg>Update MathematicalFunctionTest.groovy<commit_after>package org.wallerlab.swy.service.energy

import org.wallerlab.swy.model.SearchSpace
import spock.lang.*

class MathematicalFunctionTest extends Specification{

	private MathematicalFunction mathematicalFunction
	
	private SearchSpace searchSpace
	
	private double[] solution
	private double energy
	
	def "Test return values of the mathematical function." () {
		
		given:
		mathematicalFunction = new MathematicalFunction()
		searchSpace = new SearchSpace()
		searchSpace.startValues = [0.0, 0.0, 0.0]
		searchSpace.endValues = [2*Math.PI, 2*Math.PI, 2*Math.PI]
		mathematicalFunction.setSearchSpace(searchSpace)
		
		expect:
		mathematicalFunction.getEnergy(solution).round(4) == energy
		
		where:
		solution					|	energy
		[0.0, 0.0, 0.0]					|	-3.0
		[2*Math.PI, 2*Math.PI, 2*Math.PI]		|	-3.0
		[Math.PI, 0.0, 2*Math.PI]			|	-2.95
		[0.0, Math.PI, Math.PI]				|	-2.90
		[Math.PI, Math.PI, Math.PI]			|	-2.85
		[0.5*Math.PI, 0.5*Math.PI, 0.5*Math.PI]    	|	0.1125
		
	}
}
{'fraction_non_alphanumeric': 0.13454011741682975, 'fraction_numerical': 0.046966731898238745, 'mean_word_length': 3.4846491228070176, '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': '5714429', 'n_tokens_mistral': 908, 'n_tokens_neox': 761, 'n_words': 154}