Count assertions and call function at the end