Skip to content

Commit 667e6ec

Browse files
committed
add test making sure no ReinterpretArray is made
1 parent 90ace0c commit 667e6ec

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/core_dispatch.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,12 @@ b = PreallocationTools.DiffCache(zeros(4), Val{4}())
164164
c = PreallocationTools.DiffCache(zeros(4), Val{4})
165165
@test structequal(a, b)
166166
@test structequal(a, b)
167+
168+
169+
# FixedSizeDiffCache get_tmp ReinterpretArray test
170+
# Ensures that get_tmp doesn't produce a Reinterpret array in some cases
171+
172+
dual_cache = FixedSizeDiffCache([0.0, 0.0, 0.0], 3)
173+
dl = zeros(ForwardDiff.Dual{Nothing, Float64, 3}, 3)
174+
175+
@test !(get_tmp(dual_cache, dl) isa Base.ReinterpretArray)

0 commit comments

Comments
 (0)