def METHOD_NAME(phi, simulation_factory, lattice_snapshot_factory):
    """Test that QuickCompress can compress (and expand) simulation boxes."""
    n = 7
    snap = lattice_snapshot_factory(n=n, a=1.1)
    v_particle = 4 / 3 * math.pi * (0.5)**3
    target_box = hoomd.Box.cube((n * n * n * v_particle / phi)**(1 / 3))
    qc = hoomd.hpmc.update.QuickCompress(trigger=hoomd.trigger.Periodic(10),
                                         target_box=target_box)
    sim = simulation_factory(snap)
    sim.operations.updaters.append(qc)
    mc = hoomd.hpmc.integrate.Sphere(default_d=0.05)
    mc.shape['A'] = dict(diameter=1)
    sim.operations.integrator = mc
    sim.run(1)
    # compression should not be complete yet
    assert not qc.complete
    # run long enough to compress the box
    while not qc.complete and sim.timestep < 1e5:
        sim.run(100)
    # compression should end the run early
    assert qc.complete
    assert mc.overlaps == 0
    assert sim.state.box == target_box