-
Notifications
You must be signed in to change notification settings - Fork 0
/
uPrototype-test.rb
52 lines (38 loc) · 986 Bytes
/
uPrototype-test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
require "test/unit"
require "./mPrototype"
class TestmPrototype < Test::Unit::TestCase
def test_instanceof
john1 = $root.inherit
john2 = john1.inherit
john3 = john2.inherit
john4 = john3.inherit
paul1 = $root.inherit
paul2 = paul1.inherit
paul3 = paul2.inherit
paul4 = paul3.inherit
assert( john4.instanceof(john1) )
assert( john4.instanceof($root) )
assert_equal(false, john1.instanceof(john4) )
assert($root.instanceof($root))
assert_equal(false, paul4.instanceof(john1))
assert(paul4.instanceof($root))
end
end
=begin
#p root
location = root.inherit
location.x = 10
location.y = 11
location.barri = :unkown
sotavent = location.inherit
sotavent.barri = :sarria
def location.lleig(param = nil)
puts "#{barri}, #{param}"
end
print "root ", root, "\n"
print "location ", location, "\n"
print "sotavent ", sotavent, "\n"
sotavent.lleig(:ok)
puts sotavent.x
puts sotavent.z
=end