Monday, November 19, 2018

Found this bug in TimeSpan.Parse

All these tests pass "successfully":

Assert.AreEqual(TimeSpan.Parse("0:00:00.0123456"), TimeSpan.Parse("0:00:00.00123456")); Assert.AreEqual(TimeSpan.Parse("0:00:00.0123456").Ticks, 123456); Assert.AreEqual(TimeSpan.Parse("0:00:00.00123456").Ticks, 123456); 

and these

Assert.AreEqual(TimeSpan.Parse("0:00:00.00000098").Ticks, 98); // (no exception thrown) Assert.ThrowsException<OverflowException>(() => TimeSpan.Parse("0:00:00.00000099")); 

*edit: dropped a (non-code) letter

Found this bug in TimeSpan.Parse Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team