-
Notifications
You must be signed in to change notification settings - Fork 54
/
ValueUtilTest.java
43 lines (31 loc) · 1.15 KB
/
ValueUtilTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* Copyright (c) 2014 Villu Ruusmann
*/
package org.dmg.pmml.adapters;
import java.math.BigDecimal;
import java.math.BigInteger;
import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public class ValueUtilTest {
@Test
public void checkDecimalRange(){
BigDecimal min = DecimalAdapter.MIN_VALUE;
BigDecimal max = DecimalAdapter.MAX_VALUE;
assertTrue(ValueUtil.checkRange(BigDecimal.ZERO, min, max));
assertTrue(ValueUtil.checkRange(min, min, max));
assertFalse(ValueUtil.checkRange(min.subtract(BigDecimal.ONE), min, max));
assertTrue(ValueUtil.checkRange(max, min, max));
assertFalse(ValueUtil.checkRange(max.add(BigDecimal.ONE), min, max));
}
@Test
public void checkIntegerRange(){
BigInteger min = IntegerAdapter.MIN_VALUE;
BigInteger max = IntegerAdapter.MAX_VALUE;
assertTrue(ValueUtil.checkRange(BigInteger.ZERO, min, max));
assertTrue(ValueUtil.checkRange(min, min, max));
assertFalse(ValueUtil.checkRange(min.subtract(BigInteger.ONE), min, max));
assertTrue(ValueUtil.checkRange(max, min, max));
assertFalse(ValueUtil.checkRange(max.add(BigInteger.ONE), min, max));
}
}