Skip to content

Commit

Permalink
fix allocation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiq committed Mar 2, 2024
1 parent afde299 commit 082e62d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/allocations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,18 @@
) samples = 1 evals = 1
@test t_options.allocs == 0

protein = Selection(select(atoms, "protein"), nmols = 1)
protein_atoms = select(atoms, "protein")
protein = Selection(protein_atoms, nmols = 1)
t_selection1 =
@benchmark Selection(select($atoms, "protein"), nmols = 1) samples = 1 evals = 1
@benchmark Selection(protein_atoms, nmols = 1) samples = 1 evals = 1
@test t_selection1.allocs < 100

tmao = Selection(select(atoms, "resname TMAO"), natomspermol = 14)
tmao_atoms = select(atoms, "resname TMAO")
tmao = Selection(tmao_atoms, natomspermol = 14)
t_selection2 =
@benchmark Selection(select($atoms, "resname TMAO"), natomspermol = 14) samples =
@benchmark Selection(tmao_atoms, natomspermol = 14) samples =
1 evals = 1
@test t_selection2.allocs < 200000
@test t_selection2.allocs < 100

trajfile = "$dir/trajectory.dcd" # because of the interpolation of @benchmark
traj = Trajectory(trajfile, protein, tmao)
Expand Down

0 comments on commit 082e62d

Please sign in to comment.