1 /*
2 * Copyright 2007, 2008, 2009 Ange Optimization ApS
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package eu.simuline.octave.type;
17
18 //import junit.framework.TestCase;
19
20 import static org.junit.Assert.assertEquals;
21
22 import org.junit.Ignore;
23 import org.junit.Test;
24
25 /**
26 * Test OctaveCell
27 */
28 public class TestOctaveCell {
29
30 /**
31 * Tests that the get methods returns a copy
32 */
33 @Test public void testReturnCopy() {
34 final OctaveCell cell = new OctaveCell(0, 0);
35 cell.set(Octave.scalar(2), 1, 1);
36 final OctaveDouble scalar = cell.get(OctaveDouble.class, 1, 1);
37 scalar.set(10.0, 1, 1);
38 assertEquals(scalar.get(1, 1), 10.0, 0.0);
39 assertEquals(cell.get(OctaveDouble.class, 1, 1).get(1, 1), 2.0, 0.0);
40 }
41
42 /**
43 * Test that equality of the 1x1 empty cell works
44 */
45 @Test public void testEquality() {
46 final OctaveCell cell1 = new OctaveCell(1, 1);
47 final OctaveCell cell2 = new OctaveCell(1, 1);
48 cell2.set(cell1.get(1, 1), 1, 1);
49 assertEquals(cell1, cell2);
50 }
51
52 }