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
|
||||||
@ -37,4 +37,5 @@ class TestAttributes < MiniTest::Test
|
|||||||
def test_type_type_type
|
def test_type_type_type
|
||||||
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
|
||||||
|
|
||||||
@ -46,4 +46,5 @@ class TestClass < MiniTest::Test
|
|||||||
assert before != @space.get_class.instance_type.hash
|
assert before != @space.get_class.instance_type.hash
|
||||||
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
|
||||||
@ -73,4 +75,5 @@ class TestDictionary < MiniTest::Test
|
|||||||
@lookup[2] = :two
|
@lookup[2] = :two
|
||||||
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
|
||||||
@ -195,4 +197,5 @@ class TestList < MiniTest::Test
|
|||||||
def test_last_empty
|
def test_last_empty
|
||||||
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
|
||||||
|
|
||||||
@ -14,4 +16,5 @@ class TestObject < MiniTest::Test
|
|||||||
assert_equal @object.get_type , @object.set_internal_word(1, @object.get_type)
|
assert_equal @object.get_type , @object.set_internal_word(1, @object.get_type)
|
||||||
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]
|
||||||
@ -159,4 +155,5 @@ class TestSpace < MiniTest::Test
|
|||||||
end
|
end
|
||||||
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})
|
||||||
@ -94,4 +95,5 @@ class TestMethod < MiniTest::Test
|
|||||||
def test_created_with_binary
|
def test_created_with_binary
|
||||||
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
|
||||||
@ -25,11 +26,11 @@ class TestEmptyWord < MiniTest::Test
|
|||||||
@word.set_char(1 , 32)
|
@word.set_char(1 , 32)
|
||||||
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
|
||||||
@ -109,5 +110,5 @@ class TestWord < MiniTest::Test
|
|||||||
two = Parfait.new_word("one")
|
two = Parfait.new_word("one")
|
||||||
assert one.compare(two)
|
assert one.compare(two)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -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()
|
||||||
@ -72,4 +72,5 @@ class BasicType < MiniTest::Test
|
|||||||
type = @mess.get_type
|
type = @mess.get_type
|
||||||
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
|
||||||
@ -42,4 +42,5 @@ class TypeHash < MiniTest::Test
|
|||||||
t2 = Parfait::Type.for_hash( list , type: :NewObj)
|
t2 = Parfait::Type.for_hash( list , type: :NewObj)
|
||||||
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
|
||||||
|
|
||||||
@ -26,4 +26,5 @@ class TypeMessages < MiniTest::Test
|
|||||||
assert_equal 5 , @mess.get_type.get_type.variable_index(:methods)
|
assert_equal 5 , @mess.get_type.get_type.variable_index(:methods)
|
||||||
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
|
||||||
@ -79,4 +79,5 @@ class TestMethodApi < MiniTest::Test
|
|||||||
def test_resolve_fail
|
def test_resolve_fail
|
||||||
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
|
||||||
@ -90,4 +90,5 @@ class TypeApi < MiniTest::Test
|
|||||||
assert counter.empty? , counter.inspect
|
assert counter.empty? , counter.inspect
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user