rubyx/test/compiler/compiler_helper.rb

41 lines
991 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
2015-10-07 14:22:47 +02:00
Phisol::Compiler.class_eval do
2014-06-25 14:20:46 +02:00
2014-07-30 20:07:48 +02:00
def check
Virtual.machine.boot.parse_and_compile @string_input
2015-07-18 14:28:57 +02:00
produced = Virtual.machine.space.get_main.source
assert_equal @output , produced
2015-07-19 10:15:38 +02:00
Virtual.machine.run_passes
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