本文整理汇总了Java中org.assertj.core.data.Offset.offset方法的典型用法代码示例。如果您正苦于以下问题:Java Offset.offset方法的具体用法?Java Offset.offset怎么用?Java Offset.offset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.assertj.core.data.Offset
的用法示例。
在下文中一共展示了Offset.offset方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testLerp
import org.assertj.core.data.Offset; //导入方法依赖的package包/类
@Test
public void testLerp() {
Offset<Double> offsetD = Offset.offset(1e-11);
Offset<Float> offsetF = Offset.offset(1e-7F);
assertThat(MathUtil.lerp(1D, 2D, 0)).isCloseTo(1, offsetD);
assertThat(MathUtil.lerp(1D, 2D, .5)).isCloseTo(1.5, offsetD);
assertThat(MathUtil.lerp(1D, 2D, 1)).isCloseTo(2, offsetD);
assertThat(MathUtil.lerp(1F, 2F, 0F)).isCloseTo(1F, offsetF);
assertThat(MathUtil.lerp(1F, 2F, .5F)).isCloseTo(1.5F, offsetF);
assertThat(MathUtil.lerp(1F, 2F, 1F)).isCloseTo(2F, offsetF);
assertThat(MathUtil.lerp(Vector3D.ZERO, Vector3DUtil.ONE, 0)).isAlmostEqualTo(Vector3D.ZERO);
assertThat(MathUtil.lerp(Vector3D.ZERO, Vector3DUtil.ONE, .5F)).isAlmostEqualTo(Vector3DUtil.ONE.scalarMultiply(0.5));
assertThat(MathUtil.lerp(Vector3D.ZERO, Vector3DUtil.ONE, 1)).isAlmostEqualTo(Vector3DUtil.ONE);
}
示例2: testBinomialICDR
import org.assertj.core.data.Offset; //导入方法依赖的package包/类
@Test
public void testBinomialICDR() {
Offset<Double> offset = Offset.offset(0.00001d);
BinomialDistribution distribution = new BinomialDistribution(8, 0.5);
assertThat(distribution.probability(0)).isCloseTo(0.00390d, offset);
assertThat(distribution.probability(1)).isCloseTo(0.03125d, offset);
assertThat(distribution.probability(2)).isCloseTo(0.10937d, offset);
assertThat(distribution.probability(3)).isCloseTo(0.21875d, offset);
assertThat(distribution.probability(4)).isCloseTo(0.27343d, offset);
assertThat(distribution.probability(5)).isCloseTo(0.21875d, offset);
assertThat(distribution.probability(6)).isCloseTo(0.10937d, offset);
assertThat(distribution.probability(7)).isCloseTo(0.03125d, offset);
assertThat(distribution.probability(8)).isCloseTo(0.00390d, offset);
}
示例3: offset
import org.assertj.core.data.Offset; //导入方法依赖的package包/类
/**
* Assertions entry point for double {@link Offset}.
* <p>
* Typical usage :
* <pre><code class='java'> assertThat(8.1).isEqualTo(8.0, offset(0.1));</code></pre>
*
* @param value the value of the offset.
* @return the created {@code Offset}.
* @throws NullPointerException if the given value is {@code null}.
* @throws IllegalArgumentException if the given value is negative.
*/
public static Offset<Double> offset(Double value) {
return Offset.offset(value);
}
示例4: offset
import org.assertj.core.data.Offset; //导入方法依赖的package包/类
/**
* Assertions entry point for float {@link Offset}.
* <p>
* Typical usage :
* <pre><code class='java'> assertThat(0.2f).isCloseTo(0.0f, offset(0.2f));</code></pre>
* @param value the allowed offset
* @return the created {@code Offset}.
* @throws NullPointerException if the given value is {@code null}.
* @throws IllegalArgumentException if the given value is negative.
*/
public static Offset<Float> offset(Float value) {
return Offset.offset(value);
}
示例5: within
import org.assertj.core.data.Offset; //导入方法依赖的package包/类
/**
* Assertions entry point for BigDecimal {@link Offset} to use with isCloseTo assertions.
* <p>
* Typical usage :
* <pre><code class='java'> assertThat(BigDecimal.TEN).isCloseTo(new BigDecimal("10.5"), within(BigDecimal.ONE));</code></pre>
*
* @param value the allowed offset
* @return the created {@code Offset}.
* @throws NullPointerException if the given value is {@code null}.
* @throws IllegalArgumentException if the given value is negative.
*/
public static Offset<BigDecimal> within(BigDecimal value) {
return Offset.offset(value);
}
示例6: within
import org.assertj.core.data.Offset; //导入方法依赖的package包/类
/**
* Alias for {@link #offset(Float)} to use with isCloseTo assertions.
* <p>
* Typical usage :
* <pre><code class='java'> assertThat(8.2f).isCloseTo(8.0f, within(0.2f));</code></pre>
*
* @param value the value of the offset.
* @return the created {@code Offset}.
* @throws NullPointerException if the given value is {@code null}.
* @throws IllegalArgumentException if the given value is negative.
*/
public static Offset<Float> within(Float value) {
return Offset.offset(value);
}
示例7: withPrecision
import org.assertj.core.data.Offset; //导入方法依赖的package包/类
/**
* Alias for {@link #offset(Double)} to use with real number assertions.
* <p>
* Typical usage :
* <pre><code class='java'> assertThat(0.1).isEqualTo(0.0, withPrecision(0.1));</code></pre>
* @param value the required precision
* @return the created {@code Offset}.
* @throws NullPointerException if the given value is {@code null}.
* @throws IllegalArgumentException if the given value is negative.
*/
public static Offset<Double> withPrecision(Double value) {
return Offset.offset(value);
}
示例8: within
import org.assertj.core.data.Offset; //导入方法依赖的package包/类
/**
* Assertions entry point for BigDecimal {@link Offset} to use with isCloseTo assertions.
* <p>
* Typical usage :
* <pre><code class='java'> assertThat(BigDecimal.TEN).isCloseTo(new BigDecimal("10.5"), within(BigDecimal.ONE));</code></pre>
*
* @param value the value of the offset.
* @return the created {@code Offset}.
* @throws NullPointerException if the given value is {@code null}.
* @throws IllegalArgumentException if the given value is negative.
*/
public static Offset<BigDecimal> within(BigDecimal value) {
return Offset.offset(value);
}
示例9: byLessThan
import org.assertj.core.data.Offset; //导入方法依赖的package包/类
/**
* Alias for {@link #offset(Double)} to use with isCloseTo assertions.
* <p>
* Typical usage :
* <pre><code class='java'> assertThat(8.1).isCloseTo(8.0, byLessThan(0.1));</code></pre>
*
* @param value the value of the offset.
* @return the created {@code Offset}.
* @throws NullPointerException if the given value is {@code null}.
* @throws IllegalArgumentException if the given value is negative.
*/
public static Offset<Double> byLessThan(Double value) {
return Offset.offset(value);
}
示例10: offset
import org.assertj.core.data.Offset; //导入方法依赖的package包/类
/**
* Assertions entry point for double {@link Offset}.
* <p>
* Typical usage :
* <pre><code class='java'> assertThat(8.1).isEqualTo(8.0, offset(0.1));</code></pre>
*
* @param value the value of the offset.
* @return the created {@code Offset}.
* @throws NullPointerException if the given value is {@code null}.
* @throws IllegalArgumentException if the given value is negative.
*/
public static Offset<Double> offset(Double value) {
return Offset.offset(value);
}