Skip to content

Commit

Permalink
Add bounds-check tests [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Feb 23, 2015
1 parent dcf3ec8 commit e1d28e3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/subarray.jl
Expand Up @@ -374,3 +374,13 @@ msk[2,1] = false
sA = sub(A, :, :, 1)
sA[msk] = 1.0
@test sA[msk] == ones(countnz(msk))

# bounds checking upon construction; see #4044, #10296
@test_throws BoundsError sub(1:10, 8:11)
A = reshape(1:20, 5, 4)
sA = sub(A, 1:2, 1:3)
@test_throws BoundsError sub(sA, 1:3, 1:3)
@test_throws BoundsError sub(sA, 1:2, 1:4)
sub(sA, 1:2, 1:2)
@test_throws BoundsError sub(A, 17:23)
sub(A, 17:20)

1 comment on commit e1d28e3

@tkelman
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't make much sense to do [ci skip] on a commit that adds new tests, does it?

Please sign in to comment.