@@ -25,11 +25,11 @@ algs_deterministic = Dict(
2525 @testset " Reference tests" begin
2626 for (name, alg) in algs_deterministic
2727 @testset " $name " begin
28- cs = quantize (img, alg)
28+ cs = @inferred quantize (img, alg)
2929 @test eltype (cs) == eltype (img)
3030 @test_reference " references/$(name) .txt" cs
3131
32- cs = quantize (HSV{Float16}, img, alg)
32+ cs = @inferred quantize (HSV{Float16}, img, alg)
3333 @test eltype (cs) == HSV{Float16}
3434 @test_reference " references/$(name) _HSV.txt" cs
3535 end
@@ -41,14 +41,14 @@ algs_deterministic = Dict(
4141 c3 = RGB (0.11 , 0.52 , 0.73 )
4242 cs = [c1, c2, c3]
4343
44- cs1 = quantize (cs, UniformQuantization (2 ))
44+ cs1 = @inferred quantize (cs, UniformQuantization (2 ))
4545 # Centers of cubes at: 0.25, 0.75
4646 # c1 and c2 get quantized to the same color
4747 @test length (cs1) == 2
4848 @test cs1[1 ] == RGB (0.25 , 0.25 , 0.75 )
4949 @test cs1[2 ] == RGB (0.25 , 0.75 , 0.75 )
5050
51- cs2 = quantize (cs, UniformQuantization (4 ))
51+ cs2 = @inferred quantize (cs, UniformQuantization (4 ))
5252 # Centers of cubes at: 0.125, 0.375, 0.625, 0.875
5353
5454 # Remember that `round` defaults to `RoundNearest`,
@@ -58,7 +58,10 @@ algs_deterministic = Dict(
5858 @test cs2[2 ] == RGB (0.375 , 0.625 , 0.625 )
5959 @test cs2[3 ] == RGB (0.125 , 0.625 , 0.625 )
6060 end
61-
61+ @testset " Type stability" begin
62+ # @inferred UniformQuantization(4) # runtime inferrence due to {N} = 4
63+ @inferred KMeansQuantization (8 )
64+ end
6265 @testset " Error messages" begin
6366 @test_throws ArgumentError UniformQuantization (0 )
6467 @test_throws ArgumentError KMeansQuantization (0 )
0 commit comments