putting melon tests into module and splitting to one per file
This commit is contained in:
parent
83d943afa5
commit
89f5badc16
@ -2,6 +2,7 @@ require_relative '../helper'
|
||||
require "register/interpreter"
|
||||
require "parser/ruby22"
|
||||
|
||||
module Melon
|
||||
module MelonTests
|
||||
|
||||
def setup
|
||||
@ -13,3 +14,4 @@ module MelonTests
|
||||
#puts @parser.parse @string_input
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,9 +1,10 @@
|
||||
require_relative 'helper'
|
||||
|
||||
module Melon
|
||||
class TestRubyAdds < MiniTest::Test
|
||||
include MelonTests
|
||||
|
||||
def test_ruby_adds
|
||||
def pest_ruby_adds
|
||||
@string_input = <<HERE
|
||||
def fibo( n)
|
||||
a = 0
|
||||
@ -21,31 +22,5 @@ HERE
|
||||
@stdout = "Hello there"
|
||||
check
|
||||
end
|
||||
|
||||
def pest_ruby_adds_looping
|
||||
@string_input = <<HERE
|
||||
def fibo( n)
|
||||
a = 0
|
||||
b = 1
|
||||
i = 1
|
||||
while( i < n ) do
|
||||
result = a + b
|
||||
a = b
|
||||
b = result
|
||||
i+= 1
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
counter = 100000
|
||||
|
||||
while(counter > 0) do
|
||||
fibo(40)
|
||||
counter -= 1
|
||||
end
|
||||
HERE
|
||||
@length = 37
|
||||
@stdout = "Hello Raisa, I am salama"
|
||||
check
|
||||
end
|
||||
end
|
||||
|
@ -1,9 +1,10 @@
|
||||
require_relative 'helper'
|
||||
|
||||
module Melon
|
||||
class TestRubyCalls < MiniTest::Test
|
||||
include MelonTests
|
||||
|
||||
def test_ruby_calls
|
||||
def pest_ruby_calls
|
||||
@string_input = <<HERE
|
||||
|
||||
def fibo_r( n )
|
||||
@ -19,27 +20,5 @@ HERE
|
||||
@stdout = "Hello there"
|
||||
check
|
||||
end
|
||||
|
||||
def pest_ruby_calls_looping
|
||||
@string_input = <<HERE
|
||||
|
||||
def fibo_r( n )
|
||||
if( n < 2 )
|
||||
return n
|
||||
else
|
||||
return fibo_r(n - 1) + fibo_r(n - 2)
|
||||
end
|
||||
end
|
||||
|
||||
counter = 1000
|
||||
|
||||
while(counter > 0) do
|
||||
fibo_r(20)
|
||||
counter -= 1
|
||||
end
|
||||
HERE
|
||||
@length = 37
|
||||
@stdout = ""
|
||||
check
|
||||
end
|
||||
end
|
||||
|
@ -1,8 +1,10 @@
|
||||
require_relative 'helper'
|
||||
|
||||
module Melon
|
||||
class TestRubyHello < MiniTest::Test
|
||||
include MelonTests
|
||||
|
||||
|
||||
def test_ruby_hello
|
||||
@string_input = <<HERE
|
||||
puts "Hello there"
|
||||
@ -11,17 +13,5 @@ HERE
|
||||
check
|
||||
end
|
||||
|
||||
def pest_ruby_hello_looping
|
||||
@string_input = <<HERE
|
||||
counter = 100000;
|
||||
while(counter > 0) do
|
||||
puts "Hello there"
|
||||
STDOUT.flush
|
||||
counter = counter - 1
|
||||
end
|
||||
HERE
|
||||
@length = 37
|
||||
@stdout = "Hello Raisa, I am salama"
|
||||
check
|
||||
end
|
||||
end
|
||||
|
@ -1,9 +1,10 @@
|
||||
require_relative 'helper'
|
||||
|
||||
module Melon
|
||||
class TestRubyItos < MiniTest::Test
|
||||
include MelonTests
|
||||
|
||||
def test_ruby_itos
|
||||
def pest_ruby_itos
|
||||
@string_input = <<HERE
|
||||
100000.to_s
|
||||
HERE
|
||||
@ -11,18 +12,5 @@ HERE
|
||||
check
|
||||
end
|
||||
|
||||
def pest_ruby_itos_looping
|
||||
@string_input = <<HERE
|
||||
counter = 100000
|
||||
|
||||
while(counter > 0) do
|
||||
str = counter.to_s
|
||||
counter = counter - 1
|
||||
end
|
||||
str
|
||||
HERE
|
||||
@length = 37
|
||||
@stdout = "Hello Raisa, I am salama"
|
||||
check
|
||||
end
|
||||
end
|
||||
|
@ -1,9 +1,10 @@
|
||||
require_relative 'helper'
|
||||
|
||||
module Melon
|
||||
class TestRubyLoop < MiniTest::Test
|
||||
include MelonTests
|
||||
|
||||
def test_ruby_loop
|
||||
def pest_ruby_loop
|
||||
@string_input = <<HERE
|
||||
counter = 100000
|
||||
while(counter > 0) do
|
||||
@ -15,3 +16,4 @@ HERE
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
34
test/melon/fragments/test_many_adds.rb
Normal file
34
test/melon/fragments/test_many_adds.rb
Normal file
@ -0,0 +1,34 @@
|
||||
require_relative 'helper'
|
||||
|
||||
module Melon
|
||||
class TestManyAdds < MiniTest::Test
|
||||
include MelonTests
|
||||
|
||||
def pest_ruby_adds_looping
|
||||
@string_input = <<HERE
|
||||
def fibo( n)
|
||||
a = 0
|
||||
b = 1
|
||||
i = 1
|
||||
while( i < n ) do
|
||||
result = a + b
|
||||
a = b
|
||||
b = result
|
||||
i+= 1
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
counter = 100000
|
||||
|
||||
while(counter > 0) do
|
||||
fibo(40)
|
||||
counter -= 1
|
||||
end
|
||||
HERE
|
||||
@length = 37
|
||||
@stdout = "Hello there"
|
||||
check
|
||||
end
|
||||
end
|
||||
end
|
30
test/melon/fragments/test_many_calls.rb
Normal file
30
test/melon/fragments/test_many_calls.rb
Normal file
@ -0,0 +1,30 @@
|
||||
require_relative 'helper'
|
||||
|
||||
module Melon
|
||||
class TestManyCalls < MiniTest::Test
|
||||
include MelonTests
|
||||
|
||||
def pest_ruby_calls_looping
|
||||
@string_input = <<HERE
|
||||
|
||||
def fibo_r( n )
|
||||
if( n < 2 )
|
||||
return n
|
||||
else
|
||||
return fibo_r(n - 1) + fibo_r(n - 2)
|
||||
end
|
||||
end
|
||||
|
||||
counter = 1000
|
||||
|
||||
while(counter > 0) do
|
||||
fibo_r(20)
|
||||
counter -= 1
|
||||
end
|
||||
HERE
|
||||
@length = 37
|
||||
@stdout = ""
|
||||
check
|
||||
end
|
||||
end
|
||||
end
|
21
test/melon/fragments/test_many_hello.rb
Normal file
21
test/melon/fragments/test_many_hello.rb
Normal file
@ -0,0 +1,21 @@
|
||||
require_relative 'helper'
|
||||
|
||||
module Melon
|
||||
class TestManyHello < MiniTest::Test
|
||||
include MelonTests
|
||||
|
||||
def pest_ruby_hello_looping
|
||||
@string_input = <<HERE
|
||||
counter = 100000;
|
||||
while(counter > 0) do
|
||||
puts "Hello there"
|
||||
STDOUT.flush
|
||||
counter = counter - 1
|
||||
end
|
||||
HERE
|
||||
@length = 37
|
||||
@stdout = "Hello there"
|
||||
check
|
||||
end
|
||||
end
|
||||
end
|
22
test/melon/fragments/test_namy_itos.rb
Normal file
22
test/melon/fragments/test_namy_itos.rb
Normal file
@ -0,0 +1,22 @@
|
||||
require_relative 'helper'
|
||||
|
||||
module Melon
|
||||
class TestManyItos < MiniTest::Test
|
||||
include MelonTests
|
||||
|
||||
def pest_ruby_itos_looping
|
||||
@string_input = <<HERE
|
||||
counter = 100000
|
||||
|
||||
while(counter > 0) do
|
||||
str = counter.to_s
|
||||
counter = counter - 1
|
||||
end
|
||||
str
|
||||
HERE
|
||||
@length = 37
|
||||
@stdout = "Hello Raisa, I am salama"
|
||||
check
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user