-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlesson1_operators.rb
More file actions
88 lines (64 loc) · 1.56 KB
/
lesson1_operators.rb
File metadata and controls
88 lines (64 loc) · 1.56 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
class LearnOperators
#add code here to make tests pass
end
describe LearnOperators do
before do
@operators = LearnOperators.new
end
it "! operator" do
@operators.not(true).must_equal false
end
it "do integer division" do
skip "make this pass"
@operators.integer_division(5, 2).must_equal 2
end
describe "division" do
it "float and integer" do
skip "make this pass"
@operators.division(5.0, 2).must_equal 2.5
end
it "integer and float" do
skip "make this pass"
@operators.division(5, 2.0).must_equal 2.5
end
it "float and float" do
skip "make this pass"
@operators.division(5.0, 2.0).must_equal 2.5
end
end
describe "remainder" do
it "return remainder a" do
skip "make this pass"
@operators.remainder(5, 2).must_equal 1
end
it "return remainder b" do
skip "make this pass"
@operators.remainder(2, 5).must_equal 2
end
end
describe "combine (+)" do
it "numbers" do
skip "make this pass"
@operators.combine(2, 5).must_equal 7
end
it "strings" do
skip "make this pass"
@operators.combine("hello", " world").must_equal "hello world"
end
it "arrays" do
skip "make this pass"
@operators.combine([1,2,3], [4,5,6]).must_equal [1,2,3,4,5,6]
end
end
describe "subtraction (-)" do
it "of numbers" do
skip "make this pass"
@operators.subtract(10,3).must_equal 7
end
it "of arrays" do
skip "make this pass"
@operators.subtract([1,2,3,4,5],[4,5]).must_equal [1,2,3]
end
end
end