Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use @suppress in test/Find.jl #97

Merged
merged 2 commits into from
May 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ julia = "1"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
UnitfulAtomic = "a7773ee8-282e-5fa2-be4e-bd808c38a91a"

[targets]
test = ["Test", "Roots", "Unitful", "UnitfulAtomic", "IterTools", "CSV"]
test = ["Test", "Roots", "Unitful", "UnitfulAtomic", "IterTools", "CSV", "Suppressor"]
48 changes: 26 additions & 22 deletions test/Find.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module Find

using Test

using Roots
using Suppressor: @suppress
using Test
using Unitful
using UnitfulAtomic

Expand Down Expand Up @@ -74,21 +74,23 @@ using EquationsOfState.Find
-9.86535084973,
-9.73155247952,
] .* u"eV"
isapprox(
map(energies) do e
findvolume(
BirchMurnaghan3rd(
40.98926572528106 * u"angstrom^3",
0.5369258245417454 * u"eV/angstrom^3",
4.178644235500821 * u"1000mm/m",
-10.842803908240892 * u"eV",
)(Energy()),
e,
(eps(), 100) .* u"angstrom^3",
)
end,
results,
)
@suppress begin
isapprox(
map(energies) do e
findvolume(
BirchMurnaghan3rd(
40.98926572528106 * u"angstrom^3",
0.5369258245417454 * u"eV/angstrom^3",
4.178644235500821 * u"1000mm/m",
-10.842803908240892 * u"eV",
)(Energy()),
e,
(eps(), 100) .* u"angstrom^3",
)
end,
results,
)
end
end

@testset "Test `findvolume` with random unit" begin
Expand All @@ -97,11 +99,13 @@ end
volumes = map(pressures) do p
findvolume(eos(Pressure()), p, (eps(1.0 * u"bohr^3"), eos.v0 * 1.3))
end
@test isapprox(
ustrip.(map(eos(Pressure()), volumes) - pressures),
zeros(11),
atol = 1e-5,
)
@suppress begin
@test isapprox(
ustrip.(map(eos(Pressure()), volumes) - pressures),
zeros(11),
atol = 1e-5,
)
end
end # testset

end # module Find