diff --git a/lib/parfait/list.rb b/lib/parfait/list.rb index ac50baa2..8fe28fce 100644 --- a/lib/parfait/list.rb +++ b/lib/parfait/list.rb @@ -50,7 +50,7 @@ module Parfait ret end alias :[] :get - + def grow_to( len ) raise "Only positive lenths, #{len}" if len < 0 old_length = get_length @@ -253,15 +253,4 @@ module Parfait end end - # new list from ruby array to be precise - def self.new_list array - list = Parfait::List.new - list.set_length array.length - index = 0 - while index < array.length do - list.set(index , array[index]) - index = index + 1 - end - list - end end diff --git a/lib/parfait/word.rb b/lib/parfait/word.rb index d871c751..9a00e8cb 100644 --- a/lib/parfait/word.rb +++ b/lib/parfait/word.rb @@ -191,14 +191,4 @@ module Parfait end end - # Word from string - def self.new_word( string ) - string = string.to_s if string.is_a? Symbol - word = Word.new( string.length ) - string.codepoints.each_with_index do |code , index | - word.set_char(index , code) - end - word - end - end diff --git a/lib/risc/parfait_adapter.rb b/lib/risc/parfait_adapter.rb index 68974994..03d9a230 100644 --- a/lib/risc/parfait_adapter.rb +++ b/lib/risc/parfait_adapter.rb @@ -23,6 +23,29 @@ module Parfait value end end + + # new list from ruby array to be precise + def self.new_list array + list = Parfait::List.new + list.set_length array.length + index = 0 + while index < array.length do + list.set(index , array[index]) + index = index + 1 + end + list + end + + # Word from string + def self.new_word( string ) + string = string.to_s if string.is_a? Symbol + word = Word.new( string.length ) + string.codepoints.each_with_index do |code , index | + word.set_char(index , code) + end + word + end + end class Symbol diff --git a/test/parfait/test_compat.rb b/test/risc/test_parfait_adapter.rb similarity index 92% rename from test/parfait/test_compat.rb rename to test/risc/test_parfait_adapter.rb index 365a0d59..c03329c6 100644 --- a/test/parfait/test_compat.rb +++ b/test/risc/test_parfait_adapter.rb @@ -1,7 +1,7 @@ require_relative "helper" module Parfait - class TestCompat < MiniTest::Test + class TestAdapter < MiniTest::Test def setup Risc.machine.boot