当前位置: 首页>>代码示例>>Java>>正文


Java Offset.offset方法代码示例

本文整理汇总了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);
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:17,代码来源:MathUtilTest.java

示例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);
}
 
开发者ID:virtualdataset,项目名称:metagen-java,代码行数:15,代码来源:IntegerDistributionsConcurrencyTest.java

示例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);
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:15,代码来源:Java6Assertions.java

示例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);
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:14,代码来源:Assertions.java

示例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);
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:15,代码来源:Assertions.java

示例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);
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:15,代码来源:Java6Assertions.java

示例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);
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:14,代码来源:Assertions.java

示例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);
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:15,代码来源:AssertionsForClassTypes.java

示例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);
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:15,代码来源:Java6Assertions.java

示例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);
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:15,代码来源:AssertionsForClassTypes.java


注:本文中的org.assertj.core.data.Offset.offset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。