Added check for negative value
Corrected test