-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.rb
63 lines (42 loc) · 847 Bytes
/
tests.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
require_relative 'instant'
a = Instant.new("1012")
b = Instant.new("2021")
w = Instant.new("948")
puts a
puts a + 30
puts a + w
puts "\n"
puts b
puts b - 30
puts b - w
puts "\n"
puts a.to_i
puts a
puts "\n"
puts b.to_i
puts b
puts "\n"
times = %w{ 10:12 935 8:30 7.50 0637 1130 11.15 0 24 23:59 }
same_times = %w{ 09:35 09.35 9:35 9.35 935 0935 9 }
(times + same_times).map { |t| Instant.new(t) }.each do |t|
puts "time: #{t} time_in_min: #{t.to_i}"
end
puts "\n"
a = Instant.new("2033")
b = Instant.new("2034")
c = Instant.new("2033")
d = Instant.new("2133")
x = %w{ 2033 2034 2033 2133}
x.map! { |t| Instant.new(t) }
puts x
puts "\n"
puts x.map { |t| t.to_i }
puts "\n"
(2..x.length).each do |i|
a = x[i-2]
b = x[i-1]
c = b - a
puts "#{b} - #{a} = #{c}"
puts "#{b.to_i} - #{a.to_i} = #{c.to_i}"
puts "\n"
end