61 lines
762 B
Ruby
Raw Normal View History

2014-05-24 10:18:54 +03:00
require_relative 'helper'
class TestIf < MiniTest::Test
include Fragments
2015-11-05 17:00:41 +02:00
def test_if_plus
2015-07-18 15:28:57 +03:00
@string_input = <<HERE
class Object
int main()
2015-10-07 10:04:55 +03:00
int n = 10
if_plus( n - 12)
return 3
else
return 4
end
end
2015-07-18 15:28:57 +03:00
end
HERE
2015-11-05 17:00:41 +02:00
@length = 28
check_return 4
2015-07-18 15:28:57 +03:00
end
2015-11-05 17:00:41 +02:00
def test_if_zero
2015-07-19 13:03:21 +03:00
@string_input = <<HERE
class Object
int main()
int n = 10
if_zero(n - 10 )
"10".putstring()
end
end
end
2015-07-19 13:03:21 +03:00
HERE
@length = 49
@stdout = "10"
2015-07-19 13:03:21 +03:00
check
end
2015-11-05 17:00:41 +02:00
def test_if_minus
2014-05-24 10:18:54 +03:00
@string_input = <<HERE
class Object
int itest(int n)
2015-11-05 17:00:41 +02:00
if_minus( n - 12)
"then".putstring()
else
"else".putstring()
end
2015-07-19 11:15:38 +03:00
end
int main()
itest(20)
end
end
2014-05-24 10:18:54 +03:00
HERE
@length = 64
@stdout = "else"
2015-07-18 15:28:57 +03:00
check
2014-05-24 10:18:54 +03:00
end
end