From 11b207ff6c2e8073227b1c1537588d749a5a7141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20W=C3=BCrfel?= Date: Mon, 22 Jan 2024 13:22:32 +0100 Subject: [PATCH] add Aqua.jl tests and remove method ambiguity --- Project.toml | 10 +++++++++- src/beziercurves.jl | 4 ++-- test/Aqua.jl | 7 +++++++ test/runtests.jl | 2 ++ 4 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 test/Aqua.jl diff --git a/Project.toml b/Project.toml index 21ee8eff..aef525eb 100644 --- a/Project.toml +++ b/Project.toml @@ -15,17 +15,25 @@ SimpleTraits = "699a6c99-e7fa-54fc-8d76-47d257e15c1d" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [compat] +Aqua = "0.8" +CairoMakie = "0.11" DataStructures = "0.17, 0.18" +FileIO = "1" GeometryBasics = "0.4" Graphs = "1.4" +LinearAlgebra="1" +Literate = "2" Makie = "0.20" NetworkLayout = "0.4.3" PolynomialRoots = "1" +ReferenceTests = "0.10" SimpleTraits = "0.9" StaticArrays = "1.2" +Test = "1" julia = "1" [extras] +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306" @@ -33,4 +41,4 @@ ReferenceTests = "324d217c-45ce-50fc-942e-d289b448e8cf" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["CairoMakie", "FileIO", "Literate", "ReferenceTests", "Test"] +test = ["Aqua", "CairoMakie", "FileIO", "Literate", "ReferenceTests", "Test"] diff --git a/src/beziercurves.jl b/src/beziercurves.jl index 2f1a9f51..269a2ab1 100644 --- a/src/beziercurves.jl +++ b/src/beziercurves.jl @@ -89,7 +89,7 @@ Method: Calculates the square distance between `pt` and path `p` and minimizes ( let a = p0 - pt, b = p - p0 t = -(a[1]*b[1] + a[2]*b[2]) / (b[1]^2 + b[2]^2) """ -function inverse_interpolate(p::BezierPath{<:Point2}, pt) +function inverse_interpolate(p::BezierPath{<:Point2}, pt::Point2) p0 = p.commands[end-1].p c = p.commands[end] N = length(p.commands) - 1 @@ -103,7 +103,7 @@ function inverse_interpolate(p::BezierPath{<:Point2}, pt) return t end -function inverse_interpolate(l::Line{PT}, pt) where PT +function inverse_interpolate(l::Line{PT}, pt::PT) where PT a = l.p0 - pt b = l.p - l.p0 t = -(a[1]*b[1] + a[2]*b[2]) / (b[1]^2 + b[2]^2) diff --git a/test/Aqua.jl b/test/Aqua.jl new file mode 100644 index 00000000..3e573ef6 --- /dev/null +++ b/test/Aqua.jl @@ -0,0 +1,7 @@ +using Aqua +using GeometryBasics + +Aqua.test_ambiguities(GraphMakie) +Aqua.test_all(GraphMakie; + ambiguities=false, + unbound_args=false) diff --git a/test/runtests.jl b/test/runtests.jl index 34f9611f..d9e148bd 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -6,6 +6,8 @@ using Makie.Colors using StaticArrays using Test +include("Aqua.jl") + include("beziercurves_test.jl") @testset "GraphMakie.jl" begin