rubyx/test/virtual/virtual_helper.rb

40 lines
945 B
Ruby
Raw Normal View History

2014-06-25 14:20:46 +02:00
require_relative '../helper'
require 'parslet/convenience'
2015-07-02 09:44:44 +02:00
2014-06-26 10:34:48 +02:00
module VirtualHelper
2014-06-25 14:20:46 +02:00
2014-07-30 20:07:48 +02:00
def check
2015-07-18 14:28:57 +02:00
Virtual.machine.boot.compile_main @string_input
produced = Virtual.machine.space.get_main.source
assert_equal @output , produced
2014-06-25 14:20:46 +02:00
end
2015-05-05 13:04:37 +02:00
2014-06-25 14:20:46 +02:00
end
2015-06-01 16:31:35 +02:00
class UnusedSofEquality
# simple thought: don't recurse for Blocks, just check their names
def == other
return false unless other.class == self.class
Sof::Util.attributes(self).each do |a|
begin
left = send(a)
rescue NoMethodError
next # not using instance variables that are not defined as attr_readers for equality
end
begin
right = other.send(a)
rescue NoMethodError
return false
end
return false unless left.class == right.class
if( left.is_a? Block)
return false unless left.name == right.name
else
return false unless left == right
end
end
return true
end
end