better test for foo, nice rythm
This commit is contained in:
parent
e3bccaa0fe
commit
33fb8e7d2f
@ -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
|
||||
|
3
test/fragments/test_all.rb
Normal file
3
test/fragments/test_all.rb
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
require_relative "test_hello"
|
||||
require_relative "test_foo"
|
18
test/fragments/test_foo.rb
Normal file
18
test/fragments/test_foo.rb
Normal 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
|
||||
|
@ -1,5 +1,4 @@
|
||||
require_relative 'helper'
|
||||
require 'parslet/convenience'
|
||||
|
||||
class TestHello < MiniTest::Test
|
||||
include Fragments
|
||||
|
@ -1,5 +0,0 @@
|
||||
def foo(x)
|
||||
a = 5
|
||||
end
|
||||
|
||||
foo( 3 )
|
@ -1 +0,0 @@
|
||||
putstring( "Hello Raisa, I am crystksdfkljsncjncn" )
|
@ -1,3 +1,3 @@
|
||||
require_relative "arm/test_all"
|
||||
#require_relative "test_runner"
|
||||
require_relative "fragments/test_all"
|
||||
require_relative "parser/test_all"
|
||||
|
Loading…
Reference in New Issue
Block a user