better test for foo, nice rythm

This commit is contained in:
Torsten Ruger 2014-05-21 21:37:04 +03:00
parent e3bccaa0fe
commit 33fb8e7d2f
7 changed files with 27 additions and 8 deletions

View File

@ -1,10 +1,15 @@
require_relative '../helper'
require 'parslet/convenience'
#test the generation of code fragments.
# ie parse assumes @string_input
# compile
# assemble/write assume a @should array with the bytes in it
# since the bytes are store, the test can be run on any machine.
# but to get the bytes, one needs to link and run the object file to confirm correctness (to be automated)
module Fragments
# need a code generator, for arm
def setup

View File

@ -0,0 +1,3 @@
require_relative "test_hello"
require_relative "test_foo"

View File

@ -0,0 +1,18 @@
require_relative 'helper'
class TestFoo < MiniTest::Test
include Fragments
def test_foo
@string_input = <<HERE
def foo(x)
a = 5
end
foo( 3 )
HERE
@should = [0x0,0xb0,0xa0,0xe3,0xe,0x0,0x2d,0xe9,0x3,0x0,0xa0,0xe3,0x2,0x0,0x0,0xeb,0xe,0x0,0xbd,0xe8,0x1,0x70,0xa0,0xe3,0x0,0x0,0x0,0xef,0x0,0x40,0x2d,0xe9,0x5,0x10,0xa0,0xe3,0x0,0x80,0xbd,0xe8]
parse
write "foo"
end
end

View File

@ -1,5 +1,4 @@
require_relative 'helper'
require 'parslet/convenience'
class TestHello < MiniTest::Test
include Fragments

View File

@ -1,5 +0,0 @@
def foo(x)
a = 5
end
foo( 3 )

View File

@ -1 +0,0 @@
putstring( "Hello Raisa, I am crystksdfkljsncjncn" )

View File

@ -1,3 +1,3 @@
require_relative "arm/test_all"
#require_relative "test_runner"
require_relative "fragments/test_all"
require_relative "parser/test_all"