wrap parfait tests in module and boot
This commit is contained in:
parent
30ba626cf9
commit
a7207a9984
11
test/parfait/helper.rb
Normal file
11
test/parfait/helper.rb
Normal file
@ -0,0 +1,11 @@
|
||||
require_relative "../helper"
|
||||
|
||||
module Parfait
|
||||
class ParfaitTest < MiniTest::Test
|
||||
|
||||
def setup
|
||||
@machine = Risc.machine.boot
|
||||
@space = Parfait.object_space
|
||||
end
|
||||
end
|
||||
end
|
@ -1,10 +1,10 @@
|
||||
require_relative "../helper"
|
||||
require_relative "helper"
|
||||
|
||||
class TestAttributes < MiniTest::Test
|
||||
module Parfait
|
||||
class TestAttributes < ParfaitTest
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
@space = Parfait.object_space
|
||||
super
|
||||
@mess = @space.first_message
|
||||
@type = @mess.get_type
|
||||
end
|
||||
@ -38,3 +38,4 @@ class TestAttributes < MiniTest::Test
|
||||
assert_equal Parfait::Type , @type.get_type.get_type.get_type.class
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,10 +1,10 @@
|
||||
require_relative "../helper"
|
||||
require_relative "helper"
|
||||
|
||||
module Parfait
|
||||
class TestBinaryCode < MiniTest::Test
|
||||
class TestBinaryCode < ParfaitTest
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
super
|
||||
@code = BinaryCode.new(10)
|
||||
end
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
require_relative "../helper"
|
||||
require_relative "helper"
|
||||
|
||||
class TestClass < MiniTest::Test
|
||||
module Parfait
|
||||
class TestClass < ParfaitTest
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
@space = Parfait.object_space
|
||||
super
|
||||
@try = @space.create_class :Try , :Object
|
||||
end
|
||||
|
||||
@ -47,3 +47,4 @@ class TestClass < MiniTest::Test
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -1,8 +1,10 @@
|
||||
require_relative "../helper"
|
||||
require_relative "helper"
|
||||
|
||||
class TestDictionary < MiniTest::Test
|
||||
module Parfait
|
||||
class TestDictionary < ParfaitTest
|
||||
|
||||
def setup
|
||||
super
|
||||
@lookup = ::Parfait::Dictionary.new
|
||||
end
|
||||
def test_dict_create
|
||||
@ -74,3 +76,4 @@ class TestDictionary < MiniTest::Test
|
||||
assert @lookup[2] == :two
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,10 +1,10 @@
|
||||
require_relative "../helper"
|
||||
require_relative "helper"
|
||||
|
||||
module Parfait
|
||||
class TestInteger < MiniTest::Test
|
||||
class TestInteger < ParfaitTest
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
super
|
||||
@int = Integer.new(10)
|
||||
end
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
require_relative "../helper"
|
||||
require_relative "helper"
|
||||
|
||||
class TestList < MiniTest::Test
|
||||
module Parfait
|
||||
class TestList < ParfaitTest
|
||||
|
||||
def setup
|
||||
super
|
||||
@list = ::Parfait::List.new
|
||||
end
|
||||
def test_isa
|
||||
@ -196,3 +198,4 @@ class TestList < MiniTest::Test
|
||||
assert_nil @list.last
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,11 +1,10 @@
|
||||
require_relative "../helper"
|
||||
require_relative "helper"
|
||||
|
||||
module Parfait
|
||||
class TestMessage < MiniTest::Test
|
||||
class TestMessage < ParfaitTest
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
@space = Parfait.object_space
|
||||
super
|
||||
@mess = @space.first_message
|
||||
end
|
||||
def test_length
|
||||
|
@ -1,11 +1,10 @@
|
||||
require_relative "../helper"
|
||||
require_relative "helper"
|
||||
|
||||
module Parfait
|
||||
class TestNamedLists < MiniTest::Test
|
||||
class TestNamedLists < ParfaitTest
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
@space = Parfait.object_space
|
||||
super
|
||||
@named_list = @space.first_message.frame
|
||||
@type = @named_list.get_type
|
||||
end
|
||||
|
@ -1,8 +1,10 @@
|
||||
require_relative "../helper"
|
||||
require_relative "helper"
|
||||
|
||||
class TestObject < MiniTest::Test
|
||||
module Parfait
|
||||
class TestObject < ParfaitTest
|
||||
|
||||
def setup
|
||||
super
|
||||
@object = ::Parfait::Object.new
|
||||
end
|
||||
|
||||
@ -15,3 +17,4 @@ class TestObject < MiniTest::Test
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -1,11 +1,7 @@
|
||||
require_relative "../helper"
|
||||
require_relative "helper"
|
||||
|
||||
class TestSpace < MiniTest::Test
|
||||
|
||||
def setup
|
||||
@machine = Risc.machine.boot
|
||||
@space = Parfait.object_space
|
||||
end
|
||||
module Parfait
|
||||
class TestSpace < ParfaitTest
|
||||
|
||||
def classes
|
||||
[:Word,:List,:Message,:NamedList,:Type,:Object,:Class,:Dictionary,:TypedMethod , :Integer]
|
||||
@ -160,3 +156,4 @@ class TestSpace < MiniTest::Test
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -1,9 +1,10 @@
|
||||
require_relative "../helper"
|
||||
require_relative "helper"
|
||||
|
||||
class TestMethod < MiniTest::Test
|
||||
module Parfait
|
||||
class TestMethod < ParfaitTest
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
super
|
||||
obj = Parfait.object_space.get_class_by_name(:Object).instance_type
|
||||
args = Parfait::Type.for_hash( obj.object_class , { bar: :Integer , foo: :Type})
|
||||
frame = Parfait::Type.for_hash( obj.object_class , { local_bar: :Integer , local_foo: :Type})
|
||||
@ -95,3 +96,4 @@ class TestMethod < MiniTest::Test
|
||||
assert @method.binary
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,6 +1,7 @@
|
||||
require_relative "../helper"
|
||||
require_relative "helper"
|
||||
|
||||
module Parfait
|
||||
class TestEmptyWord < MiniTest::Test
|
||||
class TestEmptyWord < ParfaitTest
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
@ -26,10 +27,10 @@ class TestEmptyWord < MiniTest::Test
|
||||
end
|
||||
end
|
||||
end
|
||||
class TestWord < MiniTest::Test
|
||||
|
||||
class TestWord < ParfaitTest
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
super
|
||||
@word = Parfait::Word.new(5)
|
||||
end
|
||||
def test_len
|
||||
|
@ -1,10 +1,10 @@
|
||||
require_relative "../../helper"
|
||||
require_relative "../helper"
|
||||
|
||||
class BasicType < MiniTest::Test
|
||||
module Parfait
|
||||
class BasicType < ParfaitTest
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
@space = Parfait.object_space
|
||||
super
|
||||
@mess = @space.first_message
|
||||
assert @mess
|
||||
@type = @mess.get_type()
|
||||
@ -73,3 +73,4 @@ class BasicType < MiniTest::Test
|
||||
assert_equal type , @mess.get_internal_word(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,10 +1,10 @@
|
||||
require_relative "../../helper"
|
||||
require_relative "../helper"
|
||||
|
||||
class TypeHash < MiniTest::Test
|
||||
module Parfait
|
||||
class TypeHash < ParfaitTest
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
@space = Parfait.object_space
|
||||
super
|
||||
@types = @space.instance_variable_ged("@types")
|
||||
@first = @types.values.first
|
||||
end
|
||||
@ -43,3 +43,4 @@ class TypeHash < MiniTest::Test
|
||||
assert t1.hash != t2.hash , "Hashes should differ"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,10 +1,10 @@
|
||||
require_relative "../../helper"
|
||||
require_relative "../helper"
|
||||
|
||||
class TypeMessages < MiniTest::Test
|
||||
module Parfait
|
||||
class TypeMessages < ParfaitTest
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
@space = Parfait.object_space
|
||||
super
|
||||
@mess = @space.first_message
|
||||
end
|
||||
|
||||
@ -27,3 +27,4 @@ class TypeMessages < MiniTest::Test
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -1,10 +1,10 @@
|
||||
require_relative "../../helper"
|
||||
require_relative "../helper"
|
||||
|
||||
class TestMethodApi < MiniTest::Test
|
||||
module Parfait
|
||||
class TestMethodApi < ParfaitTest
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
@space = Parfait.object_space
|
||||
super
|
||||
@try_class = @space.create_class( :Try )
|
||||
@try_type = @try_class.instance_type
|
||||
end
|
||||
@ -80,3 +80,4 @@ class TestMethodApi < MiniTest::Test
|
||||
assert_nil object_type.resolve_method( :foo )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,10 +1,10 @@
|
||||
require_relative "../../helper"
|
||||
require_relative "../helper"
|
||||
|
||||
class TypeApi < MiniTest::Test
|
||||
module Parfait
|
||||
class TypeApi < ParfaitTest
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
@space = Parfait.object_space
|
||||
super
|
||||
tc = @space.get_class_by_name( :NamedList )
|
||||
@type = tc.instance_type
|
||||
end
|
||||
@ -91,3 +91,4 @@ class TypeApi < MiniTest::Test
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user