Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.truffle.api.codegen.test/src/com/oracle/truffle/api/codegen/test/RuntimeStringTest.java @ 8257:141af6b3b72b
Cleanup.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Wed, 13 Mar 2013 20:05:11 +0100 |
parents | cb70ed101b5f |
children | a3ce41332d76 |
rev | line source |
---|---|
8246
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
1 /* |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved. |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
4 * |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
8 * |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
13 * accompanied this code). |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
14 * |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
18 * |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
21 * questions. |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
22 */ |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
23 package com.oracle.truffle.api.codegen.test; |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
24 |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
25 import org.junit.*; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
26 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
27 import com.oracle.truffle.api.*; |
8246
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
28 import com.oracle.truffle.api.codegen.*; |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
29 import com.oracle.truffle.api.codegen.test.TypeSystemTest.TestRootNode; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
30 import com.oracle.truffle.api.codegen.test.TypeSystemTest.ValueNode; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
31 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
32 public class RuntimeStringTest { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
33 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
34 @Test |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
35 public void testSubstr() { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
36 assertExecute(new RuntimeString("es"), "substr", new RuntimeString("test"), 1, 3); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
37 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
38 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
39 @Test |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
40 public void testConcat() { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
41 assertExecute(new RuntimeString("concatconcat"), "concat", new RuntimeString("concat"), new RuntimeString("concat")); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
42 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
43 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
44 @Test(expected = ArrayIndexOutOfBoundsException.class) |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
45 public void testConcatFail() { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
46 assertExecute(new RuntimeString("concatconcat"), "concat", new RuntimeString("concat")); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
47 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
48 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
49 @Test |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
50 public void testFindMethodByMethodName() { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
51 // TODO |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
52 } |
8246
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
53 |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
54 private static void assertExecute(Object expectedResult, String name, Object... argumentsArray) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
55 ArgNode[] args = new ArgNode[argumentsArray.length]; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
56 for (int i = 0; i < args.length; i++) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
57 args[i] = new ArgNode(argumentsArray, i); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
58 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
59 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
60 BuiltinNode node = null; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
61 for (NodeFactory<BuiltinNode> nodeFactory : RuntimeStringTestFactory.getFactories()) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
62 GeneratedBy generated = nodeFactory.getClass().getAnnotation(GeneratedBy.class); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
63 Assert.assertNotNull(generated); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
64 Assert.assertNotSame("", generated.methodName()); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
65 if (generated.methodName().equals(name)) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
66 node = nodeFactory.createNode((Object) args); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
67 break; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
68 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
69 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
70 Assert.assertNotNull("Node not found", node); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
71 CallTarget target = Truffle.getRuntime().createCallTarget(new TestRootNode(node)); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
72 Assert.assertEquals(expectedResult, target.call()); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
73 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
74 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
75 static class ArgNode extends ValueNode { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
76 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
77 final Object[] arguments; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
78 final int index; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
79 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
80 ArgNode(Object[] args, int index) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
81 this.arguments = args; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
82 this.index = index; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
83 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
84 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
85 @Override |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
86 Object execute() { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
87 return arguments[index]; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
88 } |
8251
cb70ed101b5f
Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents:
8249
diff
changeset
|
89 |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
90 } |
8246
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
91 |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
92 abstract static class BuiltinNode extends ValueNode { |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
93 |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
94 @Children ArgNode[] parameters; |
8246
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
95 |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
96 BuiltinNode(ArgNode[] parameters) { |
8246
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
97 this.parameters = adoptChildren(parameters); |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
98 } |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
99 |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
100 BuiltinNode(BuiltinNode prev) { |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
101 this(prev.parameters); |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
102 } |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
103 |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
104 } |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
105 |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
106 @NodeClass(BuiltinNode.class) |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
107 static class RuntimeString { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
108 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
109 private final String internal; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
110 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
111 public RuntimeString(String internal) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
112 this.internal = internal; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
113 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
114 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
115 @Specialization |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
116 static RuntimeString concat(RuntimeString s1, RuntimeString s2) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
117 return new RuntimeString(s1.internal + s2.internal); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
118 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
119 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
120 @Specialization |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
121 RuntimeString substr(int beginIndex, int endIndex) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
122 return new RuntimeString(internal.substring(beginIndex, endIndex)); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
123 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
124 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
125 @Generic |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
126 RuntimeString substr(Object beginIndex, Object endIndex) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
127 return substr(convertInt(beginIndex), convertInt(endIndex)); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
128 } |
8246
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
129 |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
130 static int convertInt(Object value) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
131 if (value instanceof Number) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
132 return ((Number) value).intValue(); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
133 } else if (value instanceof String) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
134 return Integer.parseInt((String) value); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
135 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
136 throw new RuntimeException("Invalid datatype"); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
137 } |
8246
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
138 |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
139 @Override |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
140 public boolean equals(Object obj) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
141 if (obj instanceof RuntimeString) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
142 return internal.equals(((RuntimeString) obj).internal); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
143 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
144 return super.equals(obj); |
8246
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
145 } |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
146 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
147 @Override |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
148 public int hashCode() { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
149 return internal.hashCode(); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
150 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
151 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
152 @Override |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
153 public String toString() { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
154 return internal; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
155 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
156 |
8246
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
157 } |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
158 |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
159 } |