Tra*_*ell 0 java floating-point
对于整数,这项任务很简单.
private int x;
private int y
private int checksOut;
public TestCase(int input, int checksOut) {
if (input == Integer.MAX_VALUE) {
throw new IllegalArgumentException("can't increment MAX_VALUE");
}
this.x = input;
this.y = input +1;
this.checksOut = checksOut;
}
@Test
public void test() {
boolean biggerThanY = y <= checksOut;
boolean smallerThanX = x >= checksOut;
assertTrue(biggerThanY || smallerThanX);
}
Run Code Online (Sandbox Code Playgroud)
如何使用原始浮点数而不是整数重写此测试,以便找不到任何未通过测试的输入和checksOut值?
| 归档时间: |
|
| 查看次数: |
60 次 |
| 最近记录: |