diff --git a/Project.toml b/Project.toml index d528728..f37b3c8 100644 --- a/Project.toml +++ b/Project.toml @@ -23,7 +23,9 @@ julia = "1" [extras] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" +Scratch = "6c6a2e73-6563-6170-7368-637461726353" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Aqua", "Test"] +test = ["Aqua", "Artifacts", "Scratch", "Test"] diff --git a/test/Artifacts.toml b/test/Artifacts.toml new file mode 100644 index 0000000..3055287 --- /dev/null +++ b/test/Artifacts.toml @@ -0,0 +1,6 @@ +[testData] +git-tree-sha1 = "0b86feae2df3679403e813226d46395e9d5f5bad" + + [[testData.download]] + sha256 = "dd3d78a99d77a5cf8c4575637ee481010d8062e4d90a1358cfda85e6570cc973" + url = "https://gist.github.com/jonschumacher/8e6ff8e2245f9820412864af7d3708e4/raw/0b86feae2df3679403e813226d46395e9d5f5bad.tar.gz" diff --git a/test/idealGradientField.h5 b/test/idealGradientField.h5 deleted file mode 100644 index dfb528d..0000000 Binary files a/test/idealGradientField.h5 and /dev/null differ diff --git a/test/runtests.jl b/test/runtests.jl index a34ba8c..fe0677c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -4,13 +4,20 @@ using MPIFiles using SphericalHarmonicExpansions using Test using Aqua +using Artifacts +using Scratch + +const datadir = artifact"testData" +@info "The test data is located at $datadir." + +const tmpdir = @get_scratch!("tmp") +@info "If you want to check the output of the tests, please head to $tmpdir." @testset "MPISphericalHarmonics.jl" begin @testset "Aqua" begin Aqua.test_all(MPISphericalHarmonics) end - @testset "Ideal Coefficents" begin ## Calculate some field values @@ -52,7 +59,6 @@ using Aqua @test_throws DimensionMismatch MPISphericalHarmonics.magneticField(coords, fieldValues[:,1:end-1], R, center, L) # number of field values != number of measured positions end - @testset "MagneticFieldCoefficients" begin ## Test Constructor @@ -168,7 +174,7 @@ using Aqua ɛ = eps(Float64) ## measurement data (without coefficients) - filename = "idealGradientField.h5" + filename = joinpath(datadir, "idealGradientField.h5") field = SphericalHarmonicsDefinedField(filename) @test isapprox(field[0.01,0.01,0.01], [-0.01,-0.01,0.02], atol=ε) @@ -181,11 +187,11 @@ using Aqua ## load coefficients from file # write coefficients in file - filename2 = "Coeffs.h5" - filename3 = "Coeffs2.h5" - filename4 = "Coeffs3.h5" - filenameW = "CoeffsW.h5" - filenameE = "CoeffsE.h5" + filename2 = joinpath(tmpdir, "Coeffs.h5") + filename3 = joinpath(tmpdir, "Coeffs2.h5") + filename4 = joinpath(tmpdir, "Coeffs3.h5") + filenameW = joinpath(tmpdir, "CoeffsW.h5") + filenameE = joinpath(tmpdir, "CoeffsE.h5") write(filename2, coeffsMF.coeffs) # add radius and center cp(filename2, filename3)