Package jasima.core.util
Class ExperimentTest
- java.lang.Object
-
- jasima.core.util.ExperimentTest
-
public class ExperimentTest extends Object
Utility class that can be used as a base class for JUnit tests which check for many results of anExperimentat once. Deriving a new test class fromExperimentTestand callingcheckResults(Map, Map)many results of an experiment can be validated with a single method call.- Author:
- Torsten Hildebrandt, 2012-08-08
-
-
Field Summary
Fields Modifier and Type Field Description org.junit.rules.ErrorCollectorerrorCollectorprotected intmaxUlpsprecision in terms of ULPs (Units in the last place), so FP comparisons work for large and small numbers;
-
Constructor Summary
Constructors Constructor Description ExperimentTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckDouble(String name, double act, double exp)protected voidcheckFloat(String name, float act, float exp)protected voidcheckKeySets(Map<String,Object> resActual, Map<String,Object> resExpected)Checks whether key sets of actual and expected results are the same.protected voidcheckResults(Map<String,Object> resActual, Map<String,Object> resExpected)Checks if all keys inresExpectedare also present inresActualand have the same values.protected voidcheckValueStat(String name, SummaryStat exp, SummaryStat act)
-
-
-
Method Detail
-
checkKeySets
protected void checkKeySets(Map<String,Object> resActual, Map<String,Object> resExpected)
Checks whether key sets of actual and expected results are the same.- Parameters:
resActual- The map of results actually obtained.resExpected- The map of expected results.
-
checkResults
protected void checkResults(Map<String,Object> resActual, Map<String,Object> resExpected)
Checks if all keys inresExpectedare also present inresActualand have the same values. Additional keys inresActualas well as the key"runTime"are ignored.- Parameters:
resActual- The map of results actually obtained.resExpected- The map of expected results.
-
checkFloat
protected void checkFloat(String name, float act, float exp)
-
checkDouble
protected void checkDouble(String name, double act, double exp)
-
checkValueStat
protected void checkValueStat(String name, SummaryStat exp, SummaryStat act)
-
-