Mercurial > hg > truffle
annotate truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/FrameDescriptorTest.java @ 22490:fa86f9f3848d
change FrameDescriptor#copy to also copy info
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Thu, 10 Dec 2015 18:51:41 +0100 |
parents | dc2bfc816011 |
children | bc3303fb3888 |
rev | line source |
---|---|
22432
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
1 /* |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
4 * |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
8 * |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
14 * |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
18 * |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
21 * questions. |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
22 */ |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.truffle.api; |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
24 |
22490
fa86f9f3848d
change FrameDescriptor#copy to also copy info
Andreas Woess <andreas.woess@oracle.com>
parents:
22435
diff
changeset
|
25 import static org.junit.Assert.assertEquals; |
fa86f9f3848d
change FrameDescriptor#copy to also copy info
Andreas Woess <andreas.woess@oracle.com>
parents:
22435
diff
changeset
|
26 |
fa86f9f3848d
change FrameDescriptor#copy to also copy info
Andreas Woess <andreas.woess@oracle.com>
parents:
22435
diff
changeset
|
27 import org.junit.Assert; |
fa86f9f3848d
change FrameDescriptor#copy to also copy info
Andreas Woess <andreas.woess@oracle.com>
parents:
22435
diff
changeset
|
28 import org.junit.Test; |
fa86f9f3848d
change FrameDescriptor#copy to also copy info
Andreas Woess <andreas.woess@oracle.com>
parents:
22435
diff
changeset
|
29 |
22432
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
30 import com.oracle.truffle.api.frame.Frame; |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
31 import com.oracle.truffle.api.frame.FrameDescriptor; |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
32 import com.oracle.truffle.api.frame.FrameSlot; |
22434
c11ce7d2e2c3
Documenting that FrameDescriptor#copy doesn't copy info and kind - isn't that an error?
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22432
diff
changeset
|
33 import com.oracle.truffle.api.frame.FrameSlotKind; |
22432
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
34 import com.oracle.truffle.api.frame.FrameSlotTypeException; |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
35 import com.oracle.truffle.api.frame.VirtualFrame; |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
36 |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
37 public class FrameDescriptorTest { |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
38 |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
39 private FrameSlot s1; |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
40 private FrameSlot s2; |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
41 private FrameSlot s3; |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
42 |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
43 @Test |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
44 public void localsDefaultValue() throws Exception { |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
45 Object defaultValue = "default"; |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
46 FrameDescriptor d = new FrameDescriptor(defaultValue); |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
47 s1 = d.addFrameSlot("v1"); |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
48 s2 = d.addFrameSlot("v2"); |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
49 s3 = d.addFrameSlot("v3"); |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
50 VirtualFrame f = Truffle.getRuntime().createVirtualFrame(new Object[]{1, 2}, d); |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
51 |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
52 assertFrame(f, d); |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
53 assertFrame(f.materialize(), d); |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
54 } |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
55 |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
56 private void assertFrame(Frame f, FrameDescriptor d) throws FrameSlotTypeException { |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
57 assertEquals("Three slots", 3, d.getSize()); |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
58 assertEquals("Three slots list", 3, d.getSlots().size()); |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
59 assertEquals("1st slot", d.getSlots().get(0), s1); |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
60 assertEquals("2nd slot", d.getSlots().get(1), s2); |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
61 assertEquals("3rd slot", d.getSlots().get(2), s3); |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
62 assertEquals("default", f.getObject(s1)); |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
63 assertEquals("default", f.getObject(s2)); |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
64 f.setInt(s3, (int) f.getArguments()[0]); |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
65 assertEquals(1, f.getInt(s3)); |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
66 } |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
67 |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
68 @Test |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
69 public void nullDefaultValue() { |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
70 Assert.assertNull(new FrameDescriptor().getDefaultValue()); |
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
71 } |
22434
c11ce7d2e2c3
Documenting that FrameDescriptor#copy doesn't copy info and kind - isn't that an error?
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22432
diff
changeset
|
72 |
c11ce7d2e2c3
Documenting that FrameDescriptor#copy doesn't copy info and kind - isn't that an error?
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22432
diff
changeset
|
73 @Test |
c11ce7d2e2c3
Documenting that FrameDescriptor#copy doesn't copy info and kind - isn't that an error?
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22432
diff
changeset
|
74 public void copy() throws Exception { |
c11ce7d2e2c3
Documenting that FrameDescriptor#copy doesn't copy info and kind - isn't that an error?
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22432
diff
changeset
|
75 Object defaultValue = "default"; |
c11ce7d2e2c3
Documenting that FrameDescriptor#copy doesn't copy info and kind - isn't that an error?
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22432
diff
changeset
|
76 FrameDescriptor d = new FrameDescriptor(defaultValue); |
c11ce7d2e2c3
Documenting that FrameDescriptor#copy doesn't copy info and kind - isn't that an error?
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22432
diff
changeset
|
77 s1 = d.addFrameSlot("v1", "i1", FrameSlotKind.Boolean); |
c11ce7d2e2c3
Documenting that FrameDescriptor#copy doesn't copy info and kind - isn't that an error?
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22432
diff
changeset
|
78 s2 = d.addFrameSlot("v2", "i2", FrameSlotKind.Float); |
c11ce7d2e2c3
Documenting that FrameDescriptor#copy doesn't copy info and kind - isn't that an error?
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22432
diff
changeset
|
79 |
c11ce7d2e2c3
Documenting that FrameDescriptor#copy doesn't copy info and kind - isn't that an error?
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22432
diff
changeset
|
80 assertEquals(2, d.getSize()); |
c11ce7d2e2c3
Documenting that FrameDescriptor#copy doesn't copy info and kind - isn't that an error?
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22432
diff
changeset
|
81 assertEquals(d.getSlots().get(1).getInfo(), "i2"); |
c11ce7d2e2c3
Documenting that FrameDescriptor#copy doesn't copy info and kind - isn't that an error?
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22432
diff
changeset
|
82 assertEquals(d.getSlots().get(1).getKind(), FrameSlotKind.Float); |
c11ce7d2e2c3
Documenting that FrameDescriptor#copy doesn't copy info and kind - isn't that an error?
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22432
diff
changeset
|
83 assertEquals(d.getSlots().get(1).getIndex(), 1); |
c11ce7d2e2c3
Documenting that FrameDescriptor#copy doesn't copy info and kind - isn't that an error?
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22432
diff
changeset
|
84 |
c11ce7d2e2c3
Documenting that FrameDescriptor#copy doesn't copy info and kind - isn't that an error?
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22432
diff
changeset
|
85 FrameDescriptor copy = d.copy(); |
22490
fa86f9f3848d
change FrameDescriptor#copy to also copy info
Andreas Woess <andreas.woess@oracle.com>
parents:
22435
diff
changeset
|
86 assertEquals(2, copy.getSize()); |
fa86f9f3848d
change FrameDescriptor#copy to also copy info
Andreas Woess <andreas.woess@oracle.com>
parents:
22435
diff
changeset
|
87 assertEquals(1, copy.getSlots().get(1).getIndex()); |
fa86f9f3848d
change FrameDescriptor#copy to also copy info
Andreas Woess <andreas.woess@oracle.com>
parents:
22435
diff
changeset
|
88 assertEquals("Info is copied", "i2", copy.getSlots().get(1).getInfo()); |
fa86f9f3848d
change FrameDescriptor#copy to also copy info
Andreas Woess <andreas.woess@oracle.com>
parents:
22435
diff
changeset
|
89 assertEquals("Kind isn't copied", FrameSlotKind.Illegal, copy.getSlots().get(1).getKind()); |
22434
c11ce7d2e2c3
Documenting that FrameDescriptor#copy doesn't copy info and kind - isn't that an error?
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22432
diff
changeset
|
90 } |
22435
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
91 |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
92 @Test |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
93 public void shallowCopy() { |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
94 Object defaultValue = "default"; |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
95 FrameDescriptor d = new FrameDescriptor(defaultValue); |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
96 s1 = d.addFrameSlot("v1", "i1", FrameSlotKind.Boolean); |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
97 s2 = d.addFrameSlot("v2", "i2", FrameSlotKind.Float); |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
98 |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
99 assertEquals(2, d.getSize()); |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
100 final FrameSlot first = d.getSlots().get(1); |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
101 assertEquals(first.getInfo(), "i2"); |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
102 assertEquals(first.getKind(), FrameSlotKind.Float); |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
103 assertEquals(first.getIndex(), 1); |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
104 |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
105 FrameDescriptor copy = d.shallowCopy(); |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
106 |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
107 assertEquals(2, copy.getSize()); |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
108 final FrameSlot firstCopy = copy.getSlots().get(1); |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
109 assertEquals("Info is copied", firstCopy.getInfo(), "i2"); |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
110 assertEquals("Kind is copied", firstCopy.getKind(), FrameSlotKind.Float); |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
111 assertEquals(firstCopy.getIndex(), 1); |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
112 |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
113 firstCopy.setKind(FrameSlotKind.Int); |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
114 assertEquals("Kind is changed", firstCopy.getKind(), FrameSlotKind.Int); |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
115 assertEquals("Kind is changed in original too!", first.getKind(), FrameSlotKind.Int); |
dc2bfc816011
Documenting and testing behavior of FrameDescriptor#shallowCopy
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22434
diff
changeset
|
116 } |
22432
079cd9183128
Documenting and testing some aspects of FrameDescriptor behavior
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
117 } |