Skip to content

Commit

Permalink
Updating tests to not be so verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
natgeo-wong committed Sep 7, 2024
1 parent 42fb806 commit 44a398e
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
using GeoRegions
using Logging
using Test

@testset "Test that all predefined GeoRegions work" begin

# Test all predefined GeoRegions
IDvec,_,_ = GeoRegions.listall()
for ID in IDvec
@test isID(ID,throw=false);
@test isGeoRegion(GeoRegion(ID),throw=false);
end

end

@testset "Test Creation, Detection and Removal of GeoRegions" begin

disable_logging(Logging.Warn)
@test !isID("TRP",throw=false)
geo1 = RectRegion("TRP","GLB","Tropics",[30,-30,360,0])
geo2 = RectRegion("TRP_DTP","GLB","Deep Tropics",[10,-10,360,0])
Expand All @@ -30,11 +21,13 @@ end
@test add(geo) === nothing
@test isGeoRegion(geo,throw=false)
rm(geo)
disable_logging(Logging.Debug)

end

@testset "Testing Directory Specification for Custom GeoRegions" begin

disable_logging(Logging.Warn)
@test !isID("TRP",path=pwd(),throw=false)
geo1 = RectRegion("TRP","GLB","Tropics",[30,-30,360,0],path=pwd())
@test !isID("TRP",throw=false)
Expand All @@ -44,10 +37,13 @@ end
@test_throws "not a valid GeoRegion identifier" rm(geo1,path=homedir())
@test rm(geo1) === nothing
@test !isGeoRegion(geo1,throw=false)
disable_logging(Logging.Debug)

end

@testset "Testing isPointinGeoRegion" begin

disable_logging(Logging.Warn)
# Test in operator
A = Point2(-20,5)
B = Point2(340,5)
Expand All @@ -57,4 +53,18 @@ end
@test in(A,geo)
@test in(B,geo)
@test !in(C,geo)
disable_logging(Logging.Debug)

end

@testset "Test that all predefined GeoRegions work" begin

disable_logging(Logging.Warn)
IDvec,_,_ = GeoRegions.listall()
for ID in IDvec
@test isID(ID,throw=false);
@test isGeoRegion(GeoRegion(ID),throw=false);
end
disable_logging(Logging.Debug)

end

0 comments on commit 44a398e

Please sign in to comment.