Skip to content

Commit d3b222c

Browse files
committed
Add unit tests for @btimed
1 parent cb0094d commit d3b222c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/ExecutionTests.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,18 @@ str = String(take!(io))
349349
@test @ballocations(sin(0)) == 0
350350
@test @ballocations(Ref(1)) == 1
351351

352+
@test let stats = @btimed sin($(foo.x)) evals = 3 samples = 10 setup = (foo.x = 0)
353+
stats.value == sin(0) &&
354+
stats.time > 0 &&
355+
stats.bytes == 0 &&
356+
stats.alloc == 0 &&
357+
stats.gctime == 0
358+
end
359+
360+
@test let stats = @btimed Ref(1)
361+
stats.bytes > 0 && stats.alloc == 1 && stats.gctime == 0
362+
end
363+
352364
let fname = tempname()
353365
try
354366
ret = open(fname, "w") do f

0 commit comments

Comments
 (0)