Rewriting tests for atomicity