From 810480a19c879bb3fa1598b6e7ac7801ecdcf4e3 Mon Sep 17 00:00:00 2001 From: Debraj Bhal <69663512+krishna-vasudev@users.noreply.github.com> Date: Thu, 14 Jan 2021 21:48:31 +0530 Subject: [PATCH] added some more tests to arrays.jl (#935) Add tests for different sizes of arrays --- test/arrays.jl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/arrays.jl b/test/arrays.jl index b33fd640..08d2fa2a 100644 --- a/test/arrays.jl +++ b/test/arrays.jl @@ -17,6 +17,23 @@ using Images, IndirectArrays, Test for (a,t) in zip(A, target) @test a === t end + + intensity1 = [0.1 0.3 0.6; 0.2 0.4 0.1] + labels1 = IndirectArray([1 2 3; 2 1 3], [RGB(1,0,0), RGB(0,0,1),RGB(0,1,0)]) + A1 = ColorizedArray(intensity1, labels1) + target1 = intensity1 .* labels1 + @test eltype(A1) == RGB{Float64} + @test size(A1) == (2,3) + @test axes(A1) == (1:2, 1:3) + for i = 1:6 + @test A1[i] === target1[i] + end + for j = 1:3, i = 1:2 + @test A1[i,j] === target1[i,j] + end + for (a,t) in zip(A1, target1) + @test a === t + end end nothing