This commit is contained in:
Torsten Rüger 2019-09-10 14:56:47 +03:00
parent c216d224ec
commit feeb9332a2
10 changed files with 11 additions and 206 deletions

View File

@ -1,14 +0,0 @@
def fibonaccit(n)
a = 0
b = 1
(n-1).times do
tmp = a
a = b
b = tmp + b
end
b
end
#1000000.times {fibonaccit( 30 )}
#10.times {|i| puts fibonaccit(i+90).class}
puts fibonaccit 90

View File

@ -1,26 +0,0 @@
require_relative 'helper'
module Rubyx
class TestRubyAdds < MiniTest::Test
include RubyxTests
def pest_ruby_adds
@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
HERE
@stdout = "Hello there"
check
end
end
end

View File

@ -1,24 +0,0 @@
require_relative 'helper'
module Rubyx
class TestRubyCalls < MiniTest::Test
include RubyxTests
def pest_ruby_calls
@string_input = <<HERE
def fibo_r( n )
if( n < 2 )
return n
else
return fibo_r(n - 1) + fibo_r(n - 2)
end
end
fibo 40
HERE
@stdout = "Hello there"
check
end
end
end

View File

@ -1,16 +0,0 @@
require_relative 'helper'
module Rubyx
class TestRubyItos < MiniTest::Test
include RubyxTests
def pest_ruby_itos
@string_input = <<HERE
100000.to_s
HERE
@stdout = "Hello there"
check
end
end
end

View File

@ -1,19 +0,0 @@
require_relative 'helper'
module Rubyx
class TestRubyLoop < MiniTest::Test
include RubyxTests
def pest_ruby_loop
@string_input = <<HERE
counter = 100000
while(counter > 0) do
counter -= 1
end
HERE
@stdout = "Hello there"
check
end
end
end

View File

@ -1,34 +0,0 @@
require_relative 'helper'
module Rubyx
class TestManyAdds < MiniTest::Test
include RubyxTests
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

View File

@ -1,30 +0,0 @@
require_relative 'helper'
module Rubyx
class TestManyCalls < MiniTest::Test
include RubyxTests
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

View File

@ -1,21 +0,0 @@
require_relative 'helper'
module Rubyx
class TestManyHello < MiniTest::Test
include RubyxTests
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

View File

@ -1,22 +0,0 @@
require_relative 'helper'
module Rubyx
class TestManyItos < MiniTest::Test
include RubyxTests
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 rubyx"
check
end
end
end

View File

@ -19,5 +19,16 @@ module Parfait
assert_equal word , Parfait.new_word(string)
assert_equal string , word.to_string
end
def test_word_type
assert_has_type Parfait.new_word("string")
end
def test_int_type
assert_has_type Parfait::Integer.new(5)
end
def assert_has_type(obj)
assert_equal Parfait::Type , obj.type.class
assert_equal Parfait::Type , obj.get_type.class
assert_equal Parfait::Type , obj.get_internal_word(0).class
end
end
end