Skip to content

Commit

Permalink
add Aqua.jl tests and remove method ambiguity
Browse files Browse the repository at this point in the history
  • Loading branch information
hexaeder committed Jan 22, 2024
1 parent 804da2d commit 11b207f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
10 changes: 9 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,30 @@ 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"
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"]
4 changes: 2 additions & 2 deletions src/beziercurves.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions test/Aqua.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using Aqua
using GeometryBasics

Aqua.test_ambiguities(GraphMakie)
Aqua.test_all(GraphMakie;
ambiguities=false,
unbound_args=false)
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ using Makie.Colors
using StaticArrays
using Test

include("Aqua.jl")

include("beziercurves_test.jl")

@testset "GraphMakie.jl" begin
Expand Down

0 comments on commit 11b207f

Please sign in to comment.