1
2
3
4
5
6 package mockit.asm.constantPool;
7
8 import static org.junit.jupiter.api.Assertions.assertEquals;
9 import static org.junit.jupiter.api.Assertions.assertTrue;
10
11 import org.junit.jupiter.api.Test;
12
13
14
15
16 final class NumericItemTest {
17
18 @Test
19 void longItemCopyConstructor() {
20 LongItem original = new LongItem(1);
21 original.setValue(123456L);
22
23 LongItem copy = new LongItem(2, original);
24 assertEquals(2, copy.index);
25 assertEquals(123456L, copy.longVal);
26 }
27
28 @Test
29 void doubleItemCopyConstructor() {
30 DoubleItem original = new DoubleItem(1);
31 original.set(3.14);
32
33 DoubleItem copy = new DoubleItem(2, original);
34 assertEquals(2, copy.index);
35 assertEquals(original.longVal, copy.longVal);
36 }
37
38 @Test
39 void doubleItemSet() {
40 DoubleItem item = new DoubleItem(1);
41 item.set(2.718);
42 assertTrue(item.longVal != 0);
43 }
44
45 @Test
46 void floatItemCopyConstructor() {
47 FloatItem original = new FloatItem(1);
48 original.set(3.14f);
49
50 FloatItem copy = new FloatItem(2, original);
51 assertEquals(2, copy.index);
52 assertEquals(original.intVal, copy.intVal);
53 }
54
55 @Test
56 void floatItemSet() {
57 FloatItem item = new FloatItem(1);
58 item.set(1.5f);
59 assertTrue(item.intVal != 0);
60 }
61 }