system/corennnnn
リビジョン | bab80642035c2fe8565ccbadf18883b7d1df6437 (tree) |
---|---|
日時 | 2009-07-10 05:54:54 |
作者 | Jack Palevich <jackpal@goog...> |
コミッター | Jack Palevich |
Add x86 floating point test.
@@ -1335,7 +1335,6 @@ class Compiler : public ErrorSink { | ||
1335 | 1335 | } |
1336 | 1336 | popType(); |
1337 | 1337 | setR0Type(pResultType); |
1338 | - printf("genop: result type %d\n", pResultType->tag); | |
1339 | 1338 | } |
1340 | 1339 | } |
1341 | 1340 |
@@ -59,8 +59,8 @@ def compileArm(args): | ||
59 | 59 | def compare(a, b): |
60 | 60 | if a != b: |
61 | 61 | firstDiff = firstDifference(a, b) |
62 | - print "Strings differ at character %d '%s' != '%s'" % ( | |
63 | - firstDiff, safeAccess(a, firstDiff), safeAccess(b, firstDiff)) | |
62 | + print "Strings differ at character %d. Common: %s. Difference '%s' != '%s'" % ( | |
63 | + firstDiff, a[0:firstDiff], safeAccess(a, firstDiff), safeAccess(b, firstDiff)) | |
64 | 64 | |
65 | 65 | def safeAccess(s, i): |
66 | 66 | if 0 <= i < len(s): |
@@ -97,7 +97,7 @@ class TestACC(unittest.TestCase): | ||
97 | 97 | self.compileCheck(["-R", "data/returnval-ansi.c"], |
98 | 98 | "Executing compiled code:\nresult: 42\n") |
99 | 99 | |
100 | - def testStingLiteralConcatenation(self): | |
100 | + def testStringLiteralConcatenation(self): | |
101 | 101 | self.compileCheck(["-R", "data/testStringConcat.c"], |
102 | 102 | "Executing compiled code:\nresult: 13\n", "Hello, world\n") |
103 | 103 |
@@ -115,6 +115,64 @@ class TestACC(unittest.TestCase): | ||
115 | 115 | "0 = 0\n010 = 8\n0x10 = 16\n'\\a' = 7\n'\\b' = 8\n'\\f' = 12\n'\\n' = 10\n'\\r' = 13\n'\\t' = 9\n'\\v' = 11\n'\\\\' = 92\n'\\'' = 39\n" + |
116 | 116 | "'\\\"' = 34\n'\\?' = 63\n'\\0' = 0\n'\\1' = 1\n'\\12' = 10\n'\\123' = 83\n'\\x0' = 0\n'\\x1' = 1\n'\\x12' = 18\n'\\x123' = 291\n'\\x1f' = 31\n'\\x1F' = 31\n") |
117 | 117 | |
118 | + def testRunFloat(self): | |
119 | + self.compileCheck(["-R", "data/float.c"], | |
120 | + "Executing compiled code:\nresult: 0\n", | |
121 | + "int: 1 float: 2.2 double: 3.3\n ftoi(1.4f)=1\n dtoi(2.4f)=2\n itof(3)=3\n itod(4)=4\nglobals: 1 2 3 4\nargs: 1 2 3 4\nlocals: 1 2 3 4\ncast rval: 2 4\ncast lval: 1.1 2 3.3 4\n") | |
122 | + | |
123 | + def testRunFlops(self): | |
124 | + self.compileCheck(["-R", "data/flops.c"], | |
125 | + "Executing compiled code:\nresult: 0\n", | |
126 | + "-1.1 = -1.1\n" + | |
127 | + "!1.2 = 0\n" + | |
128 | + "!0 = 1\n" + | |
129 | + "double op double:\n" + | |
130 | + "1 + 2 = 3\n" + | |
131 | + "1 - 2 = -1\n" + | |
132 | + "1 * 2 = 2\n" + | |
133 | + "1 / 2 = 0.5\n" + | |
134 | + "float op float:\n" + | |
135 | + "1 + 2 = 3\n" + | |
136 | + "1 - 2 = -1\n" + | |
137 | + "1 * 2 = 2\n" + | |
138 | + "1 / 2 = 0.5\n" + | |
139 | + "double op float:\n" + | |
140 | + "1 + 2 = 3\n" + | |
141 | + "1 - 2 = -1\n" + | |
142 | + "1 * 2 = 2\n" + | |
143 | + "1 / 2 = 0.5\n" + | |
144 | + "double op int:\n" + | |
145 | + "1 + 2 = 3\n" + | |
146 | + "1 - 2 = -1\n" + | |
147 | + "1 * 2 = 2\n" + | |
148 | + "1 / 2 = 0.5\n" + | |
149 | + "int op double:\n" + | |
150 | + "1 + 2 = 3\n" + | |
151 | + "1 - 2 = -1\n" + | |
152 | + "1 * 2 = 2\n" + | |
153 | + "1 / 2 = 0.5\n" + | |
154 | + "double op double:\n" + | |
155 | + "1 op 2: < 1 <= 1 == 0 >= 0 > 0 != 1\n" + | |
156 | + "1 op 1: < 0 <= 1 == 1 >= 1 > 0 != 0\n" + | |
157 | + "2 op 1: < 0 <= 0 == 0 >= 1 > 1 != 1\n" + | |
158 | + "double op float:\n" + | |
159 | + "1 op 2: < 1 <= 1 == 0 >= 0 > 0 != 1\n" + | |
160 | + "1 op 1: < 0 <= 1 == 1 >= 1 > 0 != 0\n" + | |
161 | + "2 op 1: < 0 <= 0 == 0 >= 1 > 1 != 1\n" + | |
162 | + "float op float:\n" + | |
163 | + "1 op 2: < 1 <= 1 == 0 >= 0 > 0 != 1\n" + | |
164 | + "1 op 1: < 0 <= 1 == 1 >= 1 > 0 != 0\n" + | |
165 | + "2 op 1: < 0 <= 0 == 0 >= 1 > 1 != 1\n" + | |
166 | + "int op double:\n" + | |
167 | + "1 op 2: < 1 <= 1 == 0 >= 0 > 0 != 1\n" + | |
168 | + "1 op 1: < 0 <= 1 == 1 >= 1 > 0 != 0\n" + | |
169 | + "2 op 1: < 0 <= 0 == 0 >= 1 > 1 != 1\n" + | |
170 | + "double op int:\n" + | |
171 | + "1 op 2: < 1 <= 1 == 0 >= 0 > 0 != 1\n" + | |
172 | + "1 op 1: < 0 <= 1 == 1 >= 1 > 0 != 0\n" + | |
173 | + "2 op 1: < 0 <= 0 == 0 >= 1 > 1 != 1\n" + | |
174 | + "branching: 1 0 1\n") | |
175 | + | |
118 | 176 | def testArmRunReturnVal(self): |
119 | 177 | self.compileCheckArm(["-R", "/system/bin/accdata/data/returnval-ansi.c"], |
120 | 178 | "Executing compiled code:\nresult: 42\n") |