fix an annoying random failure in test/sparse.jl

ref #6854

also fix an old mistake of mine in the test for #5853 where the loop should be over the dense version