Mercurial > lcfOS
view test/testsamples.py @ 358:5ef1cb1bb54f
Fix nosetests
author | Windel Bouwman |
---|---|
date | Fri, 14 Mar 2014 15:17:49 +0100 |
parents | c2ddc8a36f5e |
children | c05ab629976a |
line wrap: on
line source
import unittest from testemulation import runQemu from ppci.recipe import RecipeLoader from ppci.tasks import TaskRunner class Samples: def testPrint(self): snippet = """ module testsample; import io; function void start() { io.print("Hello world"); } """ self.do(snippet, "Hello world") def testForLoopPrint(self): snippet = """ module testsample; import io; function void start() { var int i; for (i=0;i<10;i++) { io.print("A"); } } """ self.do(snippet, "AAAAAAAAAA") class TestSamplesOnVexpress(unittest.TestCase, Samples): def do(self, src, expected_output): runner = TaskRunner() recipe_loader = RecipeLoader(runner) return # TODO: improve recipe loading?? recipe_loader.load_dict({ 'link': { 'inputs': [ ], 'layout': { 'code': 0x60010000, 'data': 0x60020000 }, 'output': 'tst.bin' } }) runner.add_task(Compile()) runner.run_tasks() res = runQemu() self.assertEqual(expected_output, res)