-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers.rb
72 lines (61 loc) · 974 Bytes
/
helpers.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#
# Print usage information
#
def usage
puts "Run this program using either:
ruby benchmark.rb
or
rake run_benchmark
Running as a rake task will allow for saving results for analysis using
the rails UI.
"
end
#
# Used to format a header for each "test section"
#
def header str
puts str
.upcase
end
#
# Very simple class to test class and accors
#
class Point
attr_accessor :x, :y
def initialize(x, y)
@x = x
@y = y
end
end
# ################################
# TESTS TO HELP IN TESTING RETURN
#
def ret i
return i
end
def ret_impl i
i
end
def yield_i i
yield i
end
# ################################
#
# Used to test Class vs Struct
#
Widget = Struct.new(:id)
point_s = Struct.new(:x, :y)
Point_s = point_s
#
# Used for testing class accessors
#
class TestClass
attr_reader :ar
attr_writer :aw
attr_accessor :aa
attr_accessor :i
class << self; attr_accessor :x end
@@x = 1
def self.sfoo; end
def foo; end
end