-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_me.rb
43 lines (35 loc) · 1.12 KB
/
test_me.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
require 'benchmark'
require File.expand_path("../smoods_board", __FILE__)
require File.expand_path("../threaded_smoods_board", __FILE__)
def usage
puts "Usage: ruby test_me.rb <smooder>"
end
if ARGV.length != 1
usage
exit
end
result = ""
bm_result = ""
bm_result << "\n\nthreaded: " + Benchmark.measure {
result << "\n\nYour FOLLOWING smoodsboard"
board = ThreadedSmoodsBoard.new.following_smoodsboard ARGV[0]
board.each_pair do |mood, stuff|
result << "\n#{mood.upcase}: #{stuff[:smooder].username} (#{stuff[:points]})"
end
}.format("%r")
bm_result << "\nnormal: " + Benchmark.measure {
result << "\n\nYour FOLLOWING smoodsboard"
board = SmoodsBoard.new.following_smoodsboard ARGV[0]
board.each_pair do |mood, stuff|
result << "\n#{mood.upcase}: #{stuff[:smooder].username} (#{stuff[:points]})"
end
}.format("%r")
# puts Benchmark.measure {
# result << "\n\nYour FOLLOWERS smoodsboard"
# board = SmoodsBoard.new.followers_smoodsboard ARGV[0]
# board.each_pair do |mood, stuff|
# result << "\n#{mood.upcase}: #{stuff[:smooder].username} (#{stuff[:points]})"
# end
# }
puts result
puts bm_result