-DoubleTryParse fixes and tests

This commit is contained in:
James Newton-King
2016-07-24 12:29:43 +12:00
parent 018589cd6b
commit 38a687f683
3 changed files with 103 additions and 9 deletions
@@ -1843,14 +1843,10 @@ third line", jsonTextReader.Value);
Assert.AreEqual(Double.MinValue, reader.Value);
reader = new JsonTextReader(new StringReader("1E+309"));
Assert.IsTrue(reader.Read());
Assert.AreEqual(typeof(double), reader.ValueType);
Assert.AreEqual(Double.PositiveInfinity, reader.Value);
ExceptionAssert.Throws<JsonReaderException>(() => reader.Read(), "Input string '1E+309' is not a valid number. Path '', line 1, position 6.");
reader = new JsonTextReader(new StringReader("-1E+5000"));
Assert.IsTrue(reader.Read());
Assert.AreEqual(typeof(double), reader.ValueType);
Assert.AreEqual(Double.NegativeInfinity, reader.Value);
ExceptionAssert.Throws<JsonReaderException>(() => reader.Read(), "Input string '-1E+5000' is not a valid number. Path '', line 1, position 8.");
reader = new JsonTextReader(new StringReader("5.1231231E"));
ExceptionAssert.Throws<JsonReaderException>(() => reader.Read(), "Input string '5.1231231E' is not a valid number. Path '', line 1, position 10.");