Skip to content

Commit 29dda2f

Browse files
committed
Add constructor test for OffsetArray.
1 parent e37309d commit 29dda2f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ julia = "1.6"
1313
[extras]
1414
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
1515
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
16+
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
1617
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1718

1819
[targets]
19-
test = ["InteractiveUtils", "Test", "BenchmarkTools"]
20+
test = ["InteractiveUtils", "Test", "BenchmarkTools", "OffsetArrays"]

test/convert.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,12 @@ struct BugStaticVector <: StaticVector{2,Int} end
5757
@test_inlined f((1,2,3,4))
5858
end
5959

60+
using OffsetArrays
61+
@testset "constructor/convert from OffsetArray" begin
62+
a = OffsetArray([-1 1;0 2], -1, -1)
63+
b = OffsetArray([-1,0,1,2], -1)
64+
c = OffsetArray(-1:2, -1)
65+
d = Base.IdentityUnitRange(-1:2)
66+
@test SVector{4}(a) === SVector{4}(b) === SVector{4}(c) === SVector{4}(d) == [-1,0,1,2]
67+
@test SMatrix{2,2}(a) === SMatrix{2,2}(b) === SMatrix{2,2}(c) === SMatrix{2,2}(d) == [-1 1;0 2]
68+
end

0 commit comments

Comments
 (0)