diff options
author | Jack Palevich <jackpal@google.com> | 2009-07-23 11:45:15 -0700 |
---|---|---|
committer | Jack Palevich <jackpal@google.com> | 2009-07-23 11:45:15 -0700 |
commit | 89baa2083fbc71d3a9fb50ddd59c1b58347bf2f3 (patch) | |
tree | d8b78acf6178b315f37ea4264927925f8d134351 /libacc/tests | |
parent | c1e49f96f97c9f19f9a87ea93336919fb1a04f26 (diff) | |
download | system_core-89baa2083fbc71d3a9fb50ddd59c1b58347bf2f3.zip system_core-89baa2083fbc71d3a9fb50ddd59c1b58347bf2f3.tar.gz system_core-89baa2083fbc71d3a9fb50ddd59c1b58347bf2f3.tar.bz2 |
Fix the ARM postdecrement operator.
Add a test for ++ and -- so this bug won't happen again.
Diffstat (limited to 'libacc/tests')
-rw-r--r-- | libacc/tests/data/iops.c | 23 | ||||
-rw-r--r-- | libacc/tests/test.py | 41 |
2 files changed, 57 insertions, 7 deletions
diff --git a/libacc/tests/data/iops.c b/libacc/tests/data/iops.c new file mode 100644 index 0000000..780e95d --- /dev/null +++ b/libacc/tests/data/iops.c @@ -0,0 +1,23 @@ +// Check integer operations + +void loops() { + int y; + printf("++\n"); + for(y = 0; y < 10; y++) { + printf("%d\n", y); + } + printf("--\n"); + for(y = 10; y >= 0; y--) { + printf("%d\n", y); + } +} + +void checkLiterals() { + printf("Literals: %d %d\n", 1, -1); +} + +int main() { + checkLiterals(); + loops(); + return 0; +} diff --git a/libacc/tests/test.py b/libacc/tests/test.py index 909886d..2a20696 100644 --- a/libacc/tests/test.py +++ b/libacc/tests/test.py @@ -128,7 +128,7 @@ class TestACC(unittest.TestCase): b2 = stdErrResult.splitlines() b1 = stdOutResult.splitlines() self.assertEqual(True, compareOuput(a1,a2,b1,b2)) - + def compileCheck(self, args, stdErrResult, stdOutResult="", targets=['arm', 'x86']): targetSet = sets.ImmutableSet(targets) @@ -143,26 +143,26 @@ class TestACC(unittest.TestCase): self.assertEqual(compileArm(args), result) def testCompileReturnVal(self): - self.compileCheck(["data/returnval-ansi.c"], "") + self.compileCheck(["data/returnval-ansi.c"], "") def testCompileOTCCANSII(self): self.compileCheck(["data/otcc-ansi.c"], "", "", ['x86']) def testRunReturnVal(self): self.compileCheck(["-R", "data/returnval-ansi.c"], - "Executing compiled code:\nresult: 42\n") + "Executing compiled code:\nresult: 42\n") def testStringLiteralConcatenation(self): self.compileCheck(["-R", "data/testStringConcat.c"], - "Executing compiled code:\nresult: 13\n", "Hello, world\n") + "Executing compiled code:\nresult: 13\n", "Hello, world\n") def testRunOTCCANSI(self): - self.compileCheck(["-R", "data/otcc-ansi.c", "data/returnval.c"], + self.compileCheck(["-R", "data/otcc-ansi.c", "data/returnval.c"], "Executing compiled code:\notcc-ansi.c: About to execute compiled code:\natcc-ansi.c: result: 42\nresult: 42\n", "", ['x86']) def testRunOTCCANSI2(self): - self.compileCheck(["-R", "data/otcc-ansi.c", "data/otcc.c", "data/returnval.c"], + self.compileCheck(["-R", "data/otcc-ansi.c", "data/otcc.c", "data/returnval.c"], "Executing compiled code:\notcc-ansi.c: About to execute compiled code:\notcc.c: about to execute compiled code.\natcc-ansi.c: result: 42\nresult: 42\n", "",['x86']) def testRunConstants(self): @@ -186,7 +186,7 @@ locals: 1 2 3 4 cast rval: 2 4 cast lval: 1.1 2 3.3 4 """) - + def testRunFlops(self): self.compileCheck(["-R", "data/flops.c"], """Executing compiled code: @@ -287,6 +287,33 @@ result: 10""", """""") self.compileCheck(["-R", "data/floatdouble.c"], """Executing compiled code: result: 0""", """0.002 0.1 10""") + def testIops(self): + self.compileCheck(["-R", "data/iops.c"], """Executing compiled code: +result: 0""", """Literals: 1 -1 +++ +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +-- +10 +9 +8 +7 +6 +5 +4 +3 +2 +1 +0 +""") if __name__ == '__main__': if not outputCanRun(): |