File tree Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Original file line number Diff line number Diff line change 1
1
@testset " Caching" begin
2
- mutable struct CacheableParameter <: AbstractImageReconstructionParameters
2
+ Base . @kwdef mutable struct CacheableParameter <: AbstractImageReconstructionParameters
3
3
factor:: Int64
4
4
cache_misses:: Ref{Int64}
5
5
end
6
- mutable struct PureCacheableParameter <: AbstractImageReconstructionParameters
6
+ Base . @kwdef mutable struct PureCacheableParameter <: AbstractImageReconstructionParameters
7
7
factor:: Int64
8
8
cache_misses:: Ref{Int64}
9
9
end
170
170
end
171
171
172
172
@testset " RecoPlan" begin
173
-
173
+ cache_misses = Ref (0 )
174
+ cached_parameter = CacheableParameter (3 , cache_misses)
175
+ cache = ProcessResultCache (; param = cached_parameter, maxsize = 1 )
176
+
177
+ plan = toPlan (cache)
178
+ setAll! (plan, :maxsize , 3 )
179
+ @test plan. cache. maxsize == 3
180
+
181
+ clear! (plan. param)
182
+ io = IOBuffer ()
183
+ toTOML (io, plan)
184
+ seekstart (io)
185
+ planCopy = loadPlan (io, [Main, AbstractImageReconstruction])
186
+
187
+ setAll! (planCopy, :factor , 3 )
188
+ setAll! (planCopy, :cache_misses , Ref (0 ))
189
+ copy1 = build (planCopy)
190
+ copy2 = build (planCopy)
191
+ @test copy1. cache == copy2. cache
192
+ resize! (copy1, 42 )
193
+
194
+ @test copy2. cache. maxsize == 42
174
195
end
175
196
176
197
end
You can’t perform that action at this time.
0 commit comments