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