Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.api.codegen.test/src/com/oracle/truffle/api/codegen/test/RuntimeStringTest.java @ 8251:cb70ed101b5f
Added automatic generation of generic specialization which throws unsupported operation if reached.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Wed, 13 Mar 2013 11:32:43 +0100 |
parents | aad7e9f4f71c |
children | 141af6b3b72b |
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; |
8251
cb70ed101b5f
Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents:
8249
diff
changeset
|
31 import com.oracle.truffle.api.nodes.*; |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
32 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
33 public class RuntimeStringTest { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
34 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
35 @Test |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
36 public void testSubstr() { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
37 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
|
38 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
39 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
40 @Test |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
41 public void testConcat() { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
42 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
|
43 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
44 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
45 @Test(expected = ArrayIndexOutOfBoundsException.class) |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
46 public void testConcatFail() { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
47 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
|
48 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
49 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
50 @Test |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
51 public void testFindMethodByMethodName() { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
52 // TODO |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
53 } |
8246
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
54 |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
55 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
|
56 ArgNode[] args = new ArgNode[argumentsArray.length]; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
57 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
|
58 args[i] = new ArgNode(argumentsArray, i); |
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 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
61 BuiltinNode node = null; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
62 for (NodeFactory<BuiltinNode> nodeFactory : RuntimeStringTestFactory.getFactories()) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
63 GeneratedBy generated = nodeFactory.getClass().getAnnotation(GeneratedBy.class); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
64 Assert.assertNotNull(generated); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
65 Assert.assertNotSame("", generated.methodName()); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
66 if (generated.methodName().equals(name)) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
67 node = nodeFactory.createNode((Object) args); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
68 break; |
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 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
71 Assert.assertNotNull("Node not found", node); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
72 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
|
73 Assert.assertEquals(expectedResult, target.call()); |
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 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
76 static class ArgNode extends ValueNode { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
77 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
78 final Object[] arguments; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
79 final int index; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
80 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
81 ArgNode(Object[] args, int index) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
82 this.arguments = args; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
83 this.index = index; |
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 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
86 @Override |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
87 Object execute() { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
88 return arguments[index]; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
89 } |
8251
cb70ed101b5f
Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents:
8249
diff
changeset
|
90 |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
91 } |
8246
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
92 |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
93 abstract static class BuiltinNode extends ValueNode { |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
94 |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
95 @Children ArgNode[] parameters; |
8246
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
96 |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
97 BuiltinNode(ArgNode[] parameters) { |
8246
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
98 this.parameters = adoptChildren(parameters); |
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 |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
101 BuiltinNode(BuiltinNode prev) { |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
102 this(prev.parameters); |
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 } |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
106 |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
107 @NodeClass(BuiltinNode.class) |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
108 static class RuntimeString { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
109 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
110 private final String internal; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
111 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
112 public RuntimeString(String internal) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
113 this.internal = internal; |
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 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
116 @Specialization |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
117 static RuntimeString concat(RuntimeString s1, RuntimeString s2) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
118 return new RuntimeString(s1.internal + s2.internal); |
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 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
121 @Specialization |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
122 RuntimeString substr(int beginIndex, int endIndex) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
123 return new RuntimeString(internal.substring(beginIndex, endIndex)); |
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 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
126 @Generic |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
127 RuntimeString substr(Object beginIndex, Object endIndex) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
128 return substr(convertInt(beginIndex), convertInt(endIndex)); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
129 } |
8246
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
130 |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
131 static int convertInt(Object value) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
132 if (value instanceof Number) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
133 return ((Number) value).intValue(); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
134 } else if (value instanceof String) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
135 return Integer.parseInt((String) value); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
136 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
137 throw new RuntimeException("Invalid datatype"); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
138 } |
8246
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
139 |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
140 @Override |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
141 public boolean equals(Object obj) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
142 if (obj instanceof RuntimeString) { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
143 return internal.equals(((RuntimeString) obj).internal); |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
144 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
145 return super.equals(obj); |
8246
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
146 } |
8249
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
147 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
148 @Override |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
149 public int hashCode() { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
150 return internal.hashCode(); |
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 |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
153 @Override |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
154 public String toString() { |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
155 return internal; |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
156 } |
aad7e9f4f71c
A few additions to codegen tests.
Christian Humer <christian.humer@gmail.com>
parents:
8246
diff
changeset
|
157 |
8246
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 |
3862508afe2f
Updated @NodeClass tests.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
160 } |