Line 0
Link Here
|
|
|
1 |
package org.apache.el.lang; |
2 |
|
3 |
import junit.framework.TestCase; |
4 |
|
5 |
import java.math.BigDecimal; |
6 |
import java.math.BigInteger; |
7 |
|
8 |
public class TestELArithmetic extends TestCase { |
9 |
private final String a = "1.1"; |
10 |
private final BigInteger b = new BigInteger("1000000000000000000000"); |
11 |
|
12 |
public void testAdd() throws Exception { |
13 |
assertEquals("1000000000000000000001.1", String.valueOf(ELArithmetic.add(a, b))); |
14 |
} |
15 |
|
16 |
public void testSubtract() throws Exception { |
17 |
assertEquals("-999999999999999999998.9", String.valueOf(ELArithmetic.subtract(a, b))); |
18 |
} |
19 |
|
20 |
public void testMultiply() throws Exception { |
21 |
assertEquals("1100000000000000000000.0", String.valueOf(ELArithmetic.multiply(a, b))); |
22 |
} |
23 |
|
24 |
public void testDivide() throws Exception { |
25 |
assertEquals("0.0", String.valueOf(ELArithmetic.divide(a, b))); |
26 |
} |
27 |
|
28 |
public void testMod() throws Exception { |
29 |
assertEquals("1.1", String.valueOf(ELArithmetic.mod(a, b))); |
30 |
} |
31 |
} |