fixed tests because of inheritance changes
This commit is contained in:
parent
bb051230f4
commit
49f73c090d
@ -4,6 +4,20 @@ module Virtual
|
|||||||
# Integer and (Object) References are the main derived classes, but float will come and ...
|
# Integer and (Object) References are the main derived classes, but float will come and ...
|
||||||
# The Mystery Type has unknown type and has only casting methods. So it must be cast to be useful.
|
# The Mystery Type has unknown type and has only casting methods. So it must be cast to be useful.
|
||||||
class Type
|
class Type
|
||||||
|
def == other
|
||||||
|
return false unless other.class == self.class
|
||||||
|
attributes.each do |a|
|
||||||
|
left = send(a)
|
||||||
|
right = other.send(a)
|
||||||
|
return false unless left.class == right.class
|
||||||
|
return false unless left == right
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
def inspect
|
||||||
|
self.class.name + ".new(" + attributes.collect{|a| send(a).inspect }.join(",")+ ")"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Integer < Type
|
class Integer < Type
|
||||||
@ -19,7 +33,9 @@ module Virtual
|
|||||||
@clazz = clazz
|
@clazz = clazz
|
||||||
end
|
end
|
||||||
attr_accessor :clazz
|
attr_accessor :clazz
|
||||||
|
def attributes
|
||||||
|
[:clazz]
|
||||||
|
end
|
||||||
def at_index block , left , right
|
def at_index block , left , right
|
||||||
block.ldr( self , left , right )
|
block.ldr( self , left , right )
|
||||||
self
|
self
|
||||||
|
Loading…
Reference in New Issue
Block a user