From c1a6003704665739c5cae5a0294abd570632157d Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Mon, 28 Apr 2014 16:47:12 +0300 Subject: [PATCH] move straight to rb files, fixed runner --- test/runners/fibo_recursice.cr | 6 ------ test/runners/fibo_recursice.rb | 8 ++++++++ test/runners/fibo_times.cr | 9 --------- test/runners/fibo_times.rb | 12 ++++++++++++ test/runners/foo.rb | 3 +++ test/test_runner.rb | 2 +- 6 files changed, 24 insertions(+), 16 deletions(-) delete mode 100644 test/runners/fibo_recursice.cr create mode 100644 test/runners/fibo_recursice.rb delete mode 100644 test/runners/fibo_times.cr create mode 100644 test/runners/fibo_times.rb create mode 100644 test/runners/foo.rb diff --git a/test/runners/fibo_recursice.cr b/test/runners/fibo_recursice.cr deleted file mode 100644 index 855f0b8f..00000000 --- a/test/runners/fibo_recursice.cr +++ /dev/null @@ -1,6 +0,0 @@ -def fibonacci_r( n ) - return n if n <= 1 - fibonacci_r( n - 1 ) + fibonacci_r( n - 2 ) -end - -puts fibonacci( 10 ) diff --git a/test/runners/fibo_recursice.rb b/test/runners/fibo_recursice.rb new file mode 100644 index 00000000..780ff5da --- /dev/null +++ b/test/runners/fibo_recursice.rb @@ -0,0 +1,8 @@ +def fibonaccir( n , put ) + return n if n <= 1 + res = fibonaccir( n - 1 , put ) + fibonaccir( n - 2 , false ) + puts(res) if put + res +end + +fibonaccir( 10 , true) diff --git a/test/runners/fibo_times.cr b/test/runners/fibo_times.cr deleted file mode 100644 index e548a0a1..00000000 --- a/test/runners/fibo_times.cr +++ /dev/null @@ -1,9 +0,0 @@ -def fibonacci_t(n) - a,b = 0,1 - n.times do - printf("%d\n", a) - a,b = b,a+b - end -end - -puts fibonacci_t( 10 ) diff --git a/test/runners/fibo_times.rb b/test/runners/fibo_times.rb new file mode 100644 index 00000000..da58861a --- /dev/null +++ b/test/runners/fibo_times.rb @@ -0,0 +1,12 @@ +def fibonaccit(n) + a = 0 + b = 1 + (n-1).times do + tmp = a + a = b + b = tmp + b + puts b + end +end + +fibonaccit( 10 ) diff --git a/test/runners/foo.rb b/test/runners/foo.rb new file mode 100644 index 00000000..94170287 --- /dev/null +++ b/test/runners/foo.rb @@ -0,0 +1,3 @@ +def foo(x) + a = 5 +end \ No newline at end of file diff --git a/test/test_runner.rb b/test/test_runner.rb index 9b71ed26..de6d28aa 100644 --- a/test/test_runner.rb +++ b/test/test_runner.rb @@ -5,7 +5,7 @@ class TestRunner < MiniTest::Test # this creates test methods dynamically , one for each file in runners directory def self.runnable_methods methods = [] - Dir[File.join(File.dirname(__FILE__) , "runners" , "*.cr")].each do |file| + Dir[File.join(File.dirname(__FILE__) , "runners" , "*.rb")].each do |file| meth = File.basename(file).split(".").first name = "test_#{meth}" methods << name