rubyx/test/mains/test_while.rb

26 lines
594 B
Ruby
Raw Normal View History

2020-03-26 19:30:47 +01:00
require_relative "helper"
module Mains
class WhileTester < MiniTest::Test
include MainsHelper
def test_while_cmp
2020-03-26 19:30:47 +01:00
@preload = "Integer.gt;Integer.plus"
@input = as_main 'a = -1; while( 0 > a); a = 1 + a;end;return a'
assert_result 0 , ""
end
def test_while_count
@preload = "Integer.gt;Integer.plus"
@input = as_main 'a = -1; while( 0 > a); a = 1 + a;end;return a'
assert_result 0 , ""
end
def test_while_simple
@input = as_main 'a = true; while( a ); a = false;end;return a'
# assert_result 4 , ""
end
2020-03-26 19:30:47 +01:00
end
end