summaryrefslogtreecommitdiff
path: root/Source/UnitTests/BasetypesTests/BigDecTests.cs
blob: cee80216e2a08e3a0071b38d2fcae8023adf2935 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using Microsoft.Basetypes;
using NUnit.Framework;
using System.Numerics;

namespace BasetypesTests
{
  [TestFixture()]
  public class BigDecTests {

    [Test()]
    public void FromStringNegative() {
      // This tests for a Bug in Boogie that used to be present where BigDec
      // would not parse strings with negative numbers correctly
      //
      // If this bug is present this test will fail when checking the mantissa
      var v = BigDec.FromString("-1.5");
      Assert.AreEqual(-1, v.Exponent);
      Assert.AreEqual(new BigInteger(-15.0), v.Mantissa);
    }

    [Test()]
    public void FromStringPositive() {
      var v = BigDec.FromString("1.5");
      Assert.AreEqual(-1, v.Exponent);
      Assert.AreEqual(new BigInteger(15.0), v.Mantissa);
    }
  }
}