Granular.jl

Julia package for granular dynamics simulation
git clone git://src.adamsgaard.dk/Granular.jl
Log | Files | Refs | README | LICENSE

commit 5a146a48bf313d33a61b3a324a9d2561df839bec
parent a19598f72d623c1a082fb021860e7b4f7bbc58eb
Author: Anders Damsgaard <andersd@riseup.net>
Date:   Tue,  3 Oct 2017 16:51:04 -0400

implement better error handling depending on PyPlot status

Diffstat:
Msrc/icefloe.jl | 2+-
Mtest/icefloe.jl | 22+++++++++++++---------
2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/icefloe.jl b/src/icefloe.jl @@ -699,7 +699,7 @@ function plotIceFloeSizeDistribution(simulation::Simulation; log_y::Bool = true) if !hasPyPlot - warn("Function not available because PyPlot is not installed") + error("Function not available because PyPlot is not installed") return end diameters = Float64[] diff --git a/test/icefloe.jl b/test/icefloe.jl @@ -29,12 +29,16 @@ SeaIce.addIceFloeCylindrical!(sim, [ 0., 0.], 10., 1., verbose=false) SeaIce.addIceFloeCylindrical!(sim, [ 0., 0.], 10., 1., verbose=false) SeaIce.compareIceFloes(sim.ice_floes[1], sim.ice_floes[2]) -SeaIce.plotIceFloeSizeDistribution(sim) -rm("test-ice-floe-size-distribution.png") -SeaIce.plotIceFloeSizeDistribution(sim, skip_fixed=false) -rm("test-ice-floe-size-distribution.png") -SeaIce.plotIceFloeSizeDistribution(sim, log_y=false) -rm("test-ice-floe-size-distribution.png") -SeaIce.plotIceFloeSizeDistribution(sim, size_type="areal") -rm("test-ice-floe-size-distribution.png") -@test_throws ErrorException SeaIce.plotIceFloeSizeDistribution(sim, size_type="asdf") +if typeof(Pkg.installed("PyPlot")) == VersionNumber + SeaIce.plotIceFloeSizeDistribution(sim) + rm("test-ice-floe-size-distribution.png") + SeaIce.plotIceFloeSizeDistribution(sim, skip_fixed=false) + rm("test-ice-floe-size-distribution.png") + SeaIce.plotIceFloeSizeDistribution(sim, log_y=false) + rm("test-ice-floe-size-distribution.png") + SeaIce.plotIceFloeSizeDistribution(sim, size_type="areal") + rm("test-ice-floe-size-distribution.png") + @test_throws ErrorException SeaIce.plotIceFloeSizeDistribution(sim, size_type="asdf") +else + @test_throws ErrorException SeaIce.plotIceFloeSizeDistribution(sim) +end