# How to test @inbounds / @boundscheck behavior?

**URL:** <https://discourse.julialang.org/t/how-to-test-inbounds-boundscheck-behavior/47419>\
**Category:** General Usage\
**Tags:** testing\
**Created:** [September 28, 2020, 4:35pm UTC](https://discourse.julialang.org/t/how-to-test-inbounds-boundscheck-behavior/47419 "2020-09-28T16:35:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![platawiec](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/platawiec/32/31914_2.png) [@platawiec](https://discourse.julialang.org/u/platawiec)\
**Post date:** [September 28, 2020, 4:35pm UTC](https://discourse.julialang.org/t/how-to-test-inbounds-boundscheck-behavior/47419/1 "2020-09-28T16:35:43Z")

</div>

My understanding is that `]test` will test a module with `check-bounds=yes`.

However, one of the things I’d like to test is that when a user uses `@inbounds`, the function I create is no longer elided, in other words the section marked by `@boundscheck` is properly ignored. But, with `check-bounds=yes`, I can’t. The julia base tests don’t really get around this, they simply check the bounds check options via `Base.JLOptions().check_bounds` and run the appropriate tests (ref. [https://github.com/JuliaLang/julia/blob/c44644442949238da70670b547312ca1ae9a9c7d/test/boundscheck\_exec.jl](https://github.com/JuliaLang/julia/blob/c44644442949238da70670b547312ca1ae9a9c7d/test/boundscheck_exec.jl))

Is there any way I can do this?

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [September 28, 2020, 4:42pm UTC](https://discourse.julialang.org/t/how-to-test-inbounds-boundscheck-behavior/47419/2 "2020-09-28T16:42:52Z")

</div>

You can run the test manually (i.e. `julia tests/runtest.jl`) and you can launch your own sub process with a different option. I’m pretty sure it was there (and probably still is) for the base bounds check test. The file you linked should have been the file run by the subprocess.

Edit: yes, ref [https://github.com/JuliaLang/julia/blob/c44644442949238da70670b547312ca1ae9a9c7d/test/boundscheck.jl](https://github.com/JuliaLang/julia/blob/c44644442949238da70670b547312ca1ae9a9c7d/test/boundscheck.jl)
