test/test_gryfxcrmod.rb in gryfxcrmod-0.1.0 vs test/test_gryfxcrmod.rb in gryfxcrmod-0.1.1
- old
+ new
@@ -25,15 +25,17 @@
FileUtils.rm(CodeRunner::Gryfx.rcp.user_defaults_location + '/' + 'test_gryfxcrmod_defaults.rb')
FileUtils.rm(tfolder + '/.CODE_RUNNER_TEMP_RUN_LIST_CACHE')
FileUtils.rm(tfolder + '/v/id_1/.code_runner_run_data')
FileUtils.rm(tfolder + '/v/id_1/code_runner_results.rb')
## Don't uncomment the line below unless you *really* know what you are doing! Replacing the test archive will break many of the tests
- Dir.chdir('test'){system "tar -czf cyclone_miller_ke.tgz cyclone_miller_ke/" unless FileTest.exist?('cyclone_miller_ke.tgz')}
+ Dir.chdir('test'){system "rm cyclone_miller_ke.tgz; tar -czf cyclone_miller_ke.tgz cyclone_miller_ke/" unless FileTest.exist?('cyclone_miller_ke.tgz')}
+ #Dir.chdir('test'){system "rm cyclone_miller_ke.tgz; tar -czf cyclone_miller_ke.tgz cyclone_miller_ke/"} #unless FileTest.exist?('cyclone_miller_ke.tgz')}
FileUtils.rm_r(tfolder)
end
def test_submission
CodeRunner.submit(T: false, C: 'gryfx', X: ENV['GRYFX_EXEC'], D: 'test_gryfxcrmod', n: '1', Y: tfolder, p: '{}')
+ CodeRunner.submit(T: false, C: 'gryfx', X: ENV['GRYFX_EXEC'], D: 'test_gryfxcrmod', n: '1', Y: tfolder, p: '{nstep: 7000, init_amp: 0.5, nonlinear_mode: "on"}')
CodeRunner::Gryfx.diff_input_files(tfolder + '/v/id_1/v_id_1.in', 'test/cyclone_miller_ke.in')
CodeRunner.status(Y: tfolder)
end
end
else
@@ -42,18 +44,35 @@
end
class TestAnalysis < Test::Unit::TestCase
def setup
Dir.chdir('test'){assert(system "tar -xzf cyclone_miller_ke.tgz")}
+ CodeRunner.run_command('ctaf', j: 2, Y: tfolder)
@runner = CodeRunner.fetch_runner(Y: tfolder)
@run = @runner.run_list[1]
end
def test_analysis
CodeRunner.status(Y: tfolder)
- assert_equal(1, @runner.run_list.size)
- #assert_equal(0.13066732664774272, @runner.run_list[1].max_growth_rate)
+ assert_equal(2, @runner.run_list.size)
+ assert_equal(0.129, @runner.run_list[1].max_growth_rate.round(3))
+ assert_equal(2.0, (@runner.run_list[2].hflux_tot_stav/1.0e4).round(0))
#assert_equal(0.13066732664774272, @runner.run_list[1].growth_rate_at_ky[0.5])
#assert_equal(:Complete, @runner.run_list[1].status)
+ end
+ def test_graphs
+ kit = @run.graphkit('phi2_by_ky_vs_time', {ky_index: :all})
+ kit.gp.logscale = "y"
+ #kit.gnuplot
+ kit = @run.graphkit('phi_real_space_surface', {n0: 2})
+ assert_equal(6, kit.data.size)
+ #kit.gnuplot
+ kit = @run.graphkit('phi_real_space_poloidal_plane', {n0: 2, interpolate_theta: 16, interpolate_x: 4, torphi: 0.0})
+ kit.gp.view = ["equal xyz", "90,0,3"]
+ assert_equal(2, kit.data[0].y.data.shape.size)
+ assert_equal(177, kit.data[0].y.data.shape[1])
+
+ #kit.gnuplot
+
end
def tfolder
'test/cyclone_miller_ke'
end
def teardown