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

Add an environment for the separate test script #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion script/GLWrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export GeodGeodesic,
geod_init,
geod_inverse

const LIBGEOD = "/opt/local/lib/proj6/lib/libproj.dylib"
const LIBGEOD = "/opt/local/lib/proj9/lib/libproj.dylib"

struct Cdouble6
x1::Cdouble
Expand Down
7 changes: 7 additions & 0 deletions script/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[deps]
GeographicLib = "c96ba436-a6fe-11e9-10ab-c9f3919c93d1"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"

[compat]
PyCall = "1"
julia = "1.6"
24 changes: 15 additions & 9 deletions script/test_GeodTest.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Pkg, PyCall

Pkg.activate(joinpath(@__DIR__, ".."))
import Pkg
Pkg.activate(@__DIR__)

using GeographicLib
using PyCall

include("GLWrapper.jl")
import .GLWrapper
Expand Down Expand Up @@ -34,8 +34,10 @@ and will take several minutes.
- Karney, C. F. F. (2010). Test set for geodesics [Data set].
Zenodo. http://doi.org/10.5281/zenodo.32156
"""
function runtest(; verbose=true, python=false, rtol=1e-5, atol=1e-5)
geod_test_file = joinpath(@__DIR__, "GeodTest.dat")
function runtest(;
verbose=true, python=false, rtol=1e-5, atol=1e-5,
geod_test_file=joinpath(@__DIR__, "GeodTest.dat")
)
if !isfile(geod_test_file)
@info("Downloading 83 MB file to $geod_test_file")
download("https://zenodo.org/record/32156/files/GeodTest.dat?download=1",
Expand Down Expand Up @@ -83,7 +85,7 @@ function runtest(; verbose=true, python=false, rtol=1e-5, atol=1e-5)
if python
v_test_py = r_test_py["$f"]
if not_equal(v_true, v_test_py, rtol=rtol, atol=atol)
push!(py_wrong_lines, (i=i, value=f, truth=v_true, v_test=v_test_py))
push!(py_wrong_lines, (i=i, value=f, truth=v_true, test=v_test_py))
end
end
end
Expand All @@ -92,9 +94,13 @@ function runtest(; verbose=true, python=false, rtol=1e-5, atol=1e-5)
end
errors = length(unique(w.i for w in wrong_lines))
errors_c = length(unique(w.i for w in c_wrong_lines))
@info("Total Julia error lines: $errors")
@info("Total C error lines: $errors_c")
inputs, wrong_lines, c_wrong_lines, py_wrong_lines
errors_python = length(unique(w.i for w in py_wrong_lines))
@info("Total Julia error lines: $errors")
@info("Total C error lines: $errors_c")
if python
@info("Total Python error lines: $errors_python")
end
(; inputs, wrong_lines, c_wrong_lines, py_wrong_lines)
end

!isinteractive() && abspath(PROGRAM_FILE) == abspath(@__FILE__) && runtest()