diff test/testGrids.jl @ 406:c377fc37c04b test/equidistantgrid

Clean up EquidistantGrid and tests after deciding that side lengths must be positive.
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Tue, 13 Oct 2020 17:16:28 +0200
parents 16dc5b19843d
children b7734413003d
line wrap: on
line diff
--- a/test/testGrids.jl	Sat Oct 10 20:05:39 2020 +0200
+++ b/test/testGrids.jl	Tue Oct 13 17:16:28 2020 +0200
@@ -9,7 +9,7 @@
     # constuctor
     @test_throws DomainError EquidistantGrid(0,0.0,1.0)
     @test_throws DomainError EquidistantGrid(1,1.0,1.0)
-    @test_throws DomainError EquidistantGrid(1,1.0,-1.0) # TODO: Remove if we allow side lengths to be negative.
+    @test_throws DomainError EquidistantGrid(1,1.0,-1.0)
     @test EquidistantGrid(4,0.0,1.0) == EquidistantGrid((4,),(0.0,),(1.0,))
 
     # size
@@ -23,14 +23,10 @@
     # spacing
     @test [spacing(EquidistantGrid(4,0.0,1.0))...] ≈ [(1. /3,)...] atol=5e-13
     @test [spacing(EquidistantGrid((5,3), (0.0,-1.0), (2.0,1.0)))...] ≈ [(0.5, 1.)...] atol=5e-13
-    # TODO: Include below if we allow side lengths to be negative.
-    #@test [spacing(EquidistantGrid((5,3), (0.0,1.0), (-1.0,-2.0)))...] ≈ [(0.25, 1.5)...] atol=5e-13
 
     # inverse_spacing
     @test [inverse_spacing(EquidistantGrid(4,0.0,1.0))...] ≈ [(3.,)...] atol=5e-13
     @test [inverse_spacing(EquidistantGrid((5,3), (0.0,-1.0), (2.0,1.0)))...] ≈ [(2, 1.)...] atol=5e-13
-    # TODO: Include below if we allow side lengths to be negative.
-    #@test [inverse_spacing(EquidistantGrid((5,3), (0.0,1.0), (-1.0,-2.0)))...] ≈ [(4., 2. /3)...] atol=5e-13
 
     # points
     g = EquidistantGrid((5,3), (-1.0,0.0), (0.0,7.11))
@@ -42,7 +38,7 @@
          (0.,0.)       (0.,7.11/2)    (0.,7.11)]
     approxequal = true;
     for i ∈ eachindex(gp)
-        approxequal=approxequal*all(isapprox.(gp[i],p[i], atol=5e-13));
+        approxequal=approxequal&&all(isapprox.(gp[i],p[i], atol=5e-13));
     end
     @test approxequal == true