move from new_object to normal new

This commit is contained in:
Torsten Ruger
2015-07-20 13:01:15 +03:00
parent 08e1852e5f
commit 2c1c38716b
13 changed files with 33 additions and 21 deletions

View File

@ -23,7 +23,7 @@ module Virtual
# Functions to generate parfait objects
def self.new_word( string )
string = string.to_s if string.is_a? Symbol
word = Parfait::Word.new_object( string.length )
word = Parfait::Word.new( string.length )
string.codepoints.each_with_index do |code , index |
word.set_char(index + 1 , code)
end

View File

@ -3,7 +3,7 @@ require_relative "../helper"
class TestList < MiniTest::Test
def setup
@list = ::Parfait::List.new_object
@list = ::Parfait::List.new
end
def test_list_create
assert @list.empty?

View File

@ -3,7 +3,7 @@ require_relative "../helper"
class TestObject < MiniTest::Test
def setup
@object = ::Parfait::Object.new_object
@object = ::Parfait::Object.new
end
def test_object_create

View File

@ -34,4 +34,15 @@ class TestSpace < MiniTest::Test
# there is a 5.times in space, but one Message gets created before
assert_equal 5 + 1 , all.length
end
def test_message_layout
mess = @machine.space.first_message
one_way = mess.get_layout
assert one_way
assert mess.instance_variable_defined :next_message
other_way = mess.get_instance_variable :layout
#puts mess.get_instance_variables
# assert other_way
# assert_equal one_way , other_way , "not same "
end
end

View File

@ -3,7 +3,7 @@ require_relative "../helper"
class TestEmptyWord < MiniTest::Test
def setup
@word = ::Parfait::Word.new_object(0)
@word = ::Parfait::Word.new(0)
end
def test_word_create
assert @word.empty?
@ -25,7 +25,7 @@ end
class TestWord < MiniTest::Test
def setup
@word = ::Parfait::Word.new_object(5)
@word = ::Parfait::Word.new(5)
end
def test_len
assert_equal 5 , @word.length
@ -42,7 +42,7 @@ class TestWord < MiniTest::Test
assert_equal @word.copy , @word
end
def test_equals_same
assert_equal ::Parfait::Word.new_object(5) , @word
assert_equal ::Parfait::Word.new(5) , @word
end
def test_index_check_get
assert_raises RuntimeError do