use of org.apache.commons.lang.math.IntRange in project gatk by broadinstitute.
the class ParamUtilsUnitTest method testInRangeSuccess.
@Test
public void testInRangeSuccess() {
Assert.assertTrue(4 == ParamUtils.inRange(4L, 3, 6, "Range calculation did not work properly"), "Did not return proper value");
Assert.assertTrue(4 == ParamUtils.inRange(4, 3, 6, "Range calculation did not work properly"), "Did not return proper value");
Assert.assertTrue(4 == ParamUtils.inRange(new IntRange(3, 6), 4, "error"));
Assert.assertTrue(4.1 == ParamUtils.inRange(4.1, 3, 6, "Range calculation did not work properly"), "Did not return proper value");
Assert.assertTrue(4.1 == ParamUtils.inRange(4.1, -3, 6, "Range calculation did not work properly"), "Did not return proper value");
Assert.assertTrue(4.1 == ParamUtils.inRange(new DoubleRange(-3, 6), 4.1, "error"));
Assert.assertTrue(0 == ParamUtils.inRange(0L, -3, 6, "Range calculation did not work properly"), "Did not return proper value");
Assert.assertTrue(0 == ParamUtils.inRange(0, -3, 6, "Range calculation did not work properly"), "Did not return proper value");
Assert.assertTrue(0 == ParamUtils.inRange(new IntRange(-3, 6), 0, "error"));
Assert.assertTrue(0.0 == ParamUtils.inRange(0.0, -3, 6, "Range calculation did not work properly"), "Did not return proper value");
Assert.assertTrue(0.0 == ParamUtils.inRange(new DoubleRange(-3, 6), 0.0, "error"));
Assert.assertTrue(0 == ParamUtils.inRange(0L, -3, 6, "Range calculation did not work properly"), "Did not return proper value");
Assert.assertTrue(0 == ParamUtils.inRange(0, -3, 6, "Range calculation did not work properly"), "Did not return proper value");
Assert.assertTrue(0 == ParamUtils.inRange(new IntRange(-3, 6), 0, "error"));
Assert.assertTrue(-1 == ParamUtils.inRange(-1L, -3, 6, "Range calculation did not work properly"), "Did not return proper value");
Assert.assertTrue(-1 == ParamUtils.inRange(-1, -3, 6, "Range calculation did not work properly"), "Did not return proper value");
Assert.assertTrue(-1 == ParamUtils.inRange(new IntRange(-3, 6), -1, "error"));
Assert.assertTrue(-1.5 == ParamUtils.inRange(-1.5, -3, 6, "Range calculation did not work properly"), "Did not return proper value");
Assert.assertTrue(-1.5 == ParamUtils.inRange(new DoubleRange(-3, 6), -1.5, "error"));
}
Aggregations