1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.math4.legacy.optim;
19
20 import org.apache.commons.math4.legacy.TestUtils;
21 import org.junit.Assert;
22 import org.junit.Test;
23
24 public class PointVectorValuePairTest {
25 @Test
26 public void testAccessors1() {
27 final double[] k = new double[] { 1.0, 2.0, 3.0 };
28 final double[] v = new double[] { 4.0, 5.0 };
29
30 final PointVectorValuePair pv = new PointVectorValuePair(k, v);
31
32 final double[] kC = pv.getPoint();
33 kC[0] = 1 - kC[0];
34 final double[] vC = pv.getValue();
35 vC[0] = 1 - vC[0];
36
37
38 TestUtils.assertEquals("k", k, pv.getPoint(), 0d);
39 TestUtils.assertEquals("v", v, pv.getValue(), 0d);
40 }
41
42 @Test
43 public void testAccessors2() {
44 final double[] k = new double[] { 1.0, 2.0, 3.0 };
45 final double[] v = new double[] { 4.0, 5.0 };
46
47 final PointVectorValuePair pv = new PointVectorValuePair(k, v);
48
49 final double[] kC = pv.getPointRef();
50 kC[0] = 1 - kC[0];
51 final double[] vC = pv.getValueRef();
52 vC[0] = 1 - vC[0];
53
54
55 Assert.assertEquals(kC[0], pv.getPoint()[0], 0d);
56 Assert.assertEquals(vC[0], pv.getValue()[0], 0d);
57 }
58 }