Skip to content

Commit

Permalink
Switch to Scratch and Artifacts (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonschumacher authored Sep 28, 2023
1 parent 7527a86 commit 13e8c8b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
6 changes: 6 additions & 0 deletions test/Artifacts.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[testData]
git-tree-sha1 = "0b86feae2df3679403e813226d46395e9d5f5bad"

[[testData.download]]
sha256 = "dd3d78a99d77a5cf8c4575637ee481010d8062e4d90a1358cfda85e6570cc973"
url = "https://gist.github.com/jonschumacher/8e6ff8e2245f9820412864af7d3708e4/raw/0b86feae2df3679403e813226d46395e9d5f5bad.tar.gz"
Binary file removed test/idealGradientField.h5
Binary file not shown.
22 changes: 14 additions & 8 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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, ambiguities=false)
end


@testset "Ideal Coefficents" begin

## Calculate some field values
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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=ε)

Expand All @@ -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)
Expand Down

0 comments on commit 13e8c8b

Please sign in to comment.