Parse int.MinValue

Aug 10, 2010 at 12:02 AM

I'd like to parse a large negative int. The following test fails (place in NumberLiteralTest), but I expected it to pass. 

    [TestMethod]
    public void LargeNegativeNumberTest()
    {
        NumberLiteral number = new NumberLiteral("Number", NumberOptions.AllowSign);
        SetTerminal(number);
        TryMatch("-2147483648");
        CheckType(typeof(int));
        Assert.IsTrue((int)_token.Value == -2147483648, "Failed to read int value");
    }

Assert.IsTrue failed. Invalid target type, expected System.Int32, found:  System.String
at Irony.Tests.TerminalTestsBase.CheckType(Type type) in _TerminalTestBase.cs: line 37
at Irony.Tests.NumberLiteralTests.LargeNegativeNumberTest() in NumberLiteralTests.cs: line 37

It looks like I can workaround this by allowing the BigInteger type.

Thanks,
Brian

 

 

 

Coordinator
Aug 10, 2010 at 5:33 PM
Definitely a bug, will see how to fix it or get a simplest workaround
Coordinator
Dec 9, 2010 at 7:03 AM

Should be fixed now

Roman