From c7918bf1e155ae2c7e2a6516f4b2ccb9094a261d Mon Sep 17 00:00:00 2001 From: hyrodium Date: Sat, 11 Nov 2023 16:06:20 +0900 Subject: [PATCH] update tests for KnotVector --- test/test_KnotVector.jl | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/test/test_KnotVector.jl b/test/test_KnotVector.jl index 3c7baa52a..25ca89623 100644 --- a/test/test_KnotVector.jl +++ b/test/test_KnotVector.jl @@ -1,8 +1,7 @@ @testset "KnotVector" begin - k1 = KnotVector([1,2,3]) - k2 = KnotVector([1,2,2,3]) - k3 = KnotVector([2,4,5]) @testset "constructor" begin + k1 = KnotVector([1,2,3]) + k2 = KnotVector([1,2,2,3]) @test k1 isa KnotVector{Int64} @test k1 == KnotVector(1:3)::KnotVector{Int} @test k1 == KnotVector([1,3,2])::KnotVector{Int64} @@ -64,6 +63,8 @@ end @testset "zeros" begin + k1 = KnotVector([1,2,3]) + @test KnotVector(Float64[]) == zero(KnotVector) @test KnotVector(Float64[]) == 0*k1 == k1*0 == zero(k1) @test KnotVector(Float64[]) == EmptyKnotVector() @@ -98,6 +99,9 @@ end @testset "iterator" begin + k1 = KnotVector([1,2,3]) + k2 = KnotVector([1,2,2,3]) + k3 = KnotVector([2,4,5]) for t in k1 @test t in k2 end @@ -110,6 +114,10 @@ end @testset "addition, multiply" begin + k1 = KnotVector([1,2,3]) + k2 = KnotVector([1,2,2,3]) + k3 = KnotVector([2,4,5]) + @test KnotVector([-1,2,3]) + 2 * KnotVector([2,5]) == KnotVector([-1,2,2,2,3,5,5]) @test KnotVector([-1,2,3]) + KnotVector([2,5]) * 2 == KnotVector([-1,2,2,2,3,5,5]) @test k1 + k3 == KnotVector([1,2,2,3,4,5]) @@ -151,6 +159,9 @@ end @testset "unique" begin + k1 = KnotVector([1,2,3]) + k2 = KnotVector([1,2,2,3]) + @test unique(k1) == k1 @test unique(k2) == k1 @test unique(EmptyKnotVector()) === EmptyKnotVector()