test/test_coderunner.rb in coderunner-0.15.13 vs test/test_coderunner.rb in coderunner-0.16.0

- old
+ new

@@ -1,13 +1,13 @@ - +if true require 'helper' require 'rbconfig' CodeRunner::RemoteCodeRunner::DISPLAY_REMOTE_INVOCATION = true -module Test::Unit::Assertions +module MiniTest::Assertions def assert_system(string) assert(system(string), "System Command: '#{string}'") end end @@ -21,11 +21,11 @@ #Dir.chdir('test') do #raise "Couldn't build test program using #{string}" unless system string #end if true -class TestSubmission < Test::Unit::TestCase +class TestSubmission < MiniTest::Test def setup string = $cpp_command + ' ../cubecalc.cc -o cubecalc' Dir.chdir('test'){CodeRunner.generate_cubecalc} FileUtils.makedirs('test/submission_results') Dir.chdir('test/submission_results'){assert_system string} @@ -76,11 +76,11 @@ FileUtils.rm_r('test/cubecalc.cc') end end -class TestCodeRunner < Test::Unit::TestCase +class TestCodeRunner < MiniTest::Test # Override this method as we want the tests to be run in the order they are defined #def self.test_methods #public_instance_methods(true).grep(/^test/).map { |m| m.to_s} @@ -199,21 +199,21 @@ @runner3 = CodeRunner.new(tfolder2).update assert_equal(20, @runner3.start_id) assert_equal(21, @runner3.max_id) #eputs "\ntesting set_start_id complete" @runner3 = CodeRunner.new(tfolder2).update - assert_nothing_raised{@mrunner = CodeRunner::Merged.new(@runner, @runner3)} + @mrunner = CodeRunner::Merged.new(@runner, @runner3) @mrunner.print_out(0) #STDIN.gets assert_equal(@runner.run_list.size + 1, @mrunner.run_list.size) @mrunner2 = @runner.merge(@runner3) assert_equal(@mrunner2.run_list.keys, @mrunner.run_list.keys) - assert_nothing_raised{@mrunner.add_runner(@runner)} + @mrunner.add_runner(@runner) assert_equal(CodeRunner::Run::Merged, @mrunner.run_list[[2, 6]].class) assert_equal(6, @mrunner.run_list[[2, 6]].run.id) assert_system("#$coderunner_command st -Y #{tfolder} -Y #{tfolder2}") - assert_raise(RuntimeError){@mrunner.submit} + assert_raises(RuntimeError){@mrunner.submit} #STDIN.gets FileUtils.rm_r tfolder2 end def test_status_with_component @@ -259,10 +259,11 @@ #assert_equal(0, @runner.run_list.values.find_all{|run| run.width==1.887}.size) #assert_raise(RuntimeError){CodeRunner.submit(Y: 'results', p: "{run_test_flags: {test_submit_error_handling: true}}", U: true)} #assert(!FileTest.exist?('results/submitting')) #end + if ENV['LATEX'] def test_latex_graphkit Dir.chdir('test/results') do #@runner.print_out(0) sds = @runner.run_graphkit('sides;;[1,2].include? id') #p sds @@ -280,11 +281,10 @@ #Process.kill 'TERM', pid #Process.kill 'TERM', pid1 end end - if ENV['LATEX'] def test_graphkit_multiplot unless ENV['SHORT_TEST'] Dir.chdir('test/results') do @@ -373,11 +373,11 @@ end # if ENV['LATEX'] end # class TestCodeRunner end # if false/true -#class TestFortranNamelist < Test::Unit::TestCase +#class TestFortranNamelist < MiniTest::Test ##require 'gs2crmod' #def test_make_defaults #Dir.chdir('test') do #CodeRunner.code_command('make_new_defaults_file("fortran_namelist", "fortran_namelist.in")', C: 'gs2') #assert(File.read('fortran_namelist_defaults.rb')=~/tprim_1/) @@ -385,11 +385,11 @@ #end #end # # ENV['CR_NON_INTERACTIVE'] = 'true' -class TestFortranNamelistC < Test::Unit::TestCase +class TestFortranNamelistC < MiniTest::Test def setup end def test_synchronise_variables #FileUtils.rm('lib/cubecalccrmod/namelists.rb') CodeRunner.setup_run_class('cubecalc', modlet: 'with_namelist') @@ -418,6 +418,8 @@ assert_equal(86.35, runner.run_list[1].volume.round(2)) FileUtils.rm_r(tfolder) FileUtils.rm(CodeRunner::Cubecalc::WithNamelist.rcp.user_defaults_location + '/cubecalctest_defaults.rb') FileUtils.rm('test/cubecalc_namelist') end +end + end