-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.rb
42 lines (34 loc) · 945 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
require 'minitest/autorun'
require './compilateur_logo'
describe CompilateurLogo do
before do
@compilateur = CompilateurLogo.new
end
describe "la tortue" do
it "peut avancer" do
@compilateur.compile("av 1").must_equal "av(1);"
@compilateur.compile("av 2").must_equal "av(2);"
end
it "peut tourner" do
@compilateur.compile("td 90").must_equal "td(90);"
end
end
it "peut enchainer les instructions" do
@compilateur.compile("av 1\nav 2").must_equal(
"av(1);\nav(2);"
)
end
it "ignore les lignes vides" do
@compilateur.compile("\nav 1\n").must_equal("av(1);")
end
it "peut apprendre des mots" do
@compilateur.compile("pour x\nav 10\nfin\nx").must_equal(
"x();\n}\nvoid x(){\nav(10);"
)
end
it "connait les arguments" do
@compilateur.compile("pour f :x\nav :x\nfin\nf 12").must_equal(
"f(12);\n}\nvoid f(Object x){\nav(x);"
)
end
end