test should throw exception given d is zero.