From 3e60bd156486ddbbcc394256514df83d377af501 Mon Sep 17 00:00:00 2001 From: Arun Lakshmanan Date: Tue, 6 Jul 2021 15:15:00 -0600 Subject: [PATCH] Fix tests --- .travis.yml | 3 ++- Project.toml | 2 +- test/Project.toml | 3 +-- test/runtests.jl | 55 +++++++++++++++++++++++++++++++++++++---------- 4 files changed, 48 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index f1e988f..5cf51a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,8 @@ os: - linux julia: - - 1.1 + - 1.4 + - 1.5 - 1.6 - nightly diff --git a/Project.toml b/Project.toml index d1e85f8..8062119 100644 --- a/Project.toml +++ b/Project.toml @@ -18,4 +18,4 @@ DataStructures = "0.15, 0.16, 0.17, 0.18" IntervalArithmetic = "0.15, 0.16, 0.17, 0.18" RecipesBase = "0.6, 0.7, 0.8, 1.0" StaticArrays = "0.10, 0.11, 0.12, 1.0" -julia = "1.1" +julia = "1.4" diff --git a/test/Project.toml b/test/Project.toml index 144205d..a0ce816 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -3,7 +3,6 @@ ConvexBodyProximityQueries = "e9983d58-8b29-5530-8046-db49618142f9" DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" IntervalArithmetic = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" @@ -16,4 +15,4 @@ IntervalArithmetic = "0.15, 0.16, 0.17, 0.18" RecipesBase = "0.6, 0.7, 0.8, 1.0" StaticArrays = "0.10, 0.11, 0.12, 1.0" Unitful = "1.0" -julia = "1.1" +julia = "1.4" diff --git a/test/runtests.jl b/test/runtests.jl index 886744c..9c2463f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -4,7 +4,6 @@ using Test using LinearAlgebra using StaticArrays using IntervalArithmetic -using Random: seed! using Unitful: nm, μm, mm, cm import CurveProximityQueries: differentiate, integrate @@ -57,9 +56,14 @@ import CurveProximityQueries: differentiate, integrate @test sum(norm.((differentiate(integrate(B3.f)) - B3.f).control_points)) ≤ 1e-10 end @testset "Curve - Polygon" begin - seed!(1) obs = @point zeros(2) - c = rand(Bernstein{2,7}) + c = Bernstein([ [0.23603334566204692, 0.34651701419196046], + [0.3127069683360675, 0.00790928339056074], + [0.4886128300795012, 0.21096820215853596], + [0.951916339835734, 0.9999046588986136], + [0.25166218303197185, 0.9866663668987996], + [0.5557510873245723, 0.43710797460962514], + [0.42471785049513144, 0.773223048457377] ]) @test abs(minimum_distance(obs, c) - 0.3683522584741768) ≤ 1e-5 @test tolerance_verification(obs, c, 0.3) == true @test tolerance_verification(obs, c, 0.4) == false @@ -69,9 +73,18 @@ import CurveProximityQueries: differentiate, integrate @test tolerance_verification(c, obs, 0.4) == false @test collision_detection(c, obs) == false - seed!(1) obs = @point zeros(3) - c = rand(Bernstein{3,11}) + c = Bernstein([ [0.23603334566204692, 0.34651701419196046, 0.3127069683360675], + [0.00790928339056074, 0.4886128300795012, 0.21096820215853596], + [0.951916339835734, 0.9999046588986136, 0.25166218303197185], + [0.9866663668987996, 0.5557510873245723, 0.43710797460962514], + [0.42471785049513144, 0.773223048457377, 0.2811902322857298], + [0.20947237319807077, 0.25137920979222494, 0.02037486871266725], + [0.2877015122756894, 0.859512136087661, 0.07695088688120899], + [0.6403962459899388, 0.8735441302706854, 0.27858242002877853], + [0.7513126327861701, 0.6448833539420931, 0.07782644396003469], + [0.8481854810000327, 0.0856351682044918, 0.5532055454580578], + [0.46335024592359875, 0.18582130997265378, 0.11198087695816716] ]) @test abs(minimum_distance(obs, c) - 0.511627527056288) ≤ 1e-5 @test tolerance_verification(obs, c, 0.5) == true @test tolerance_verification(obs, c, 0.6) == false @@ -82,17 +95,37 @@ import CurveProximityQueries: differentiate, integrate @test collision_detection(c, obs) == false end @testset "Curve - Curve" begin - seed!(1) - c = rand(Bernstein{2,7}) - d = rand(Bernstein{2,3}) + c = Bernstein([ [0.23603334566204692, 0.34651701419196046], + [0.3127069683360675, 0.00790928339056074], + [0.4886128300795012, 0.21096820215853596], + [0.951916339835734, 0.9999046588986136], + [0.25166218303197185, 0.9866663668987996], + [0.5557510873245723, 0.43710797460962514], + [0.42471785049513144, 0.773223048457377] ]) + d = Bernstein([ [0.2811902322857298, 0.20947237319807077], + [0.25137920979222494, 0.02037486871266725], + [0.2877015122756894, 0.859512136087661] ]) @test abs(minimum_distance(c, d)) ≤ 1e-5 @test tolerance_verification(c, d, 0.3) == false @test collision_detection(c, d) == true - seed!(1) obs = @point zeros(3) - c = rand(Bernstein{3,11}) - d = rand(Bernstein{3,5}) + c = Bernstein([ [0.23603334566204692, 0.34651701419196046, 0.3127069683360675], + [0.00790928339056074, 0.4886128300795012, 0.21096820215853596], + [0.951916339835734, 0.9999046588986136, 0.25166218303197185], + [0.9866663668987996, 0.5557510873245723, 0.43710797460962514], + [0.42471785049513144, 0.773223048457377, 0.2811902322857298], + [0.20947237319807077, 0.25137920979222494, 0.02037486871266725], + [0.2877015122756894, 0.859512136087661, 0.07695088688120899], + [0.6403962459899388, 0.8735441302706854, 0.27858242002877853], + [0.7513126327861701, 0.6448833539420931, 0.07782644396003469], + [0.8481854810000327, 0.0856351682044918, 0.5532055454580578], + [0.46335024592359875, 0.18582130997265378, 0.11198087695816716] ]) + d = Bernstein([ [0.976311881619359, 0.051614620674327094, 0.5380295812064833], + [0.4556920516275036, 0.2793951106725605, 0.17824610354168602], + [0.5489828719625274, 0.37097066286146885, 0.8941659192657594], + [0.6480537482231894, 0.4170393538841062, 0.14456554241360564], + [0.6224031828206811, 0.8723344353741975, 0.5249746566167794] ]) @test abs(minimum_distance(c, d) - 0.137873546917387) ≤ 1e-5 @test tolerance_verification(c, d, 0.1) == true @test tolerance_verification(c, d, 0.3) == false