public void TestUncertaintyFromPercentage()
        {
            Uncertainty u = Uncertainty.FromPercentage(2, 0, 1.25);

            Assert.AreEqual(2, u.Value);
            Assert.AreEqual(0, u.LowerUncertainty);
            Assert.AreEqual(2.5, u.UpperUncertainty);
            Assert.IsTrue(u.IsRelative);
        }
        public void TestUncertaintySymmetric()
        {
            var u1 = new Uncertainty(6, 0.5);
            var u2 = Uncertainty.FromPercentage(7, 0.10, 0.10);

            Assert.IsTrue(u1.IsSymmetric());
            Assert.AreEqual(u1.LowerUncertainty, u1.UpperUncertainty);
            Assert.AreEqual(u1.LowerPercentage, u1.UpperPercentage);
            Assert.IsTrue(u2.IsSymmetric());
            Assert.AreEqual(u2.LowerUncertainty, u2.UpperUncertainty);
            Assert.AreEqual(u2.LowerPercentage, u2.UpperPercentage);
        }
        public void TestUncertaintyDivideConstantRelative()
        {
            var u1 = Uncertainty.FromPercentage(8, 0.1, 0.2);
            var u2 = u1.Divide(2);

            Assert.AreEqual(u2, u1 / 2);
            Assert.AreEqual(0.25, (2 / u1).Value, 0.00001);
            Assert.AreEqual(4, u2.Value);
            Assert.AreEqual(0.1, u2.LowerPercentage, 0.00001);
            Assert.AreEqual(0.2, u2.UpperPercentage, 0.00001);
            Assert.AreEqual(0.4, u2.LowerUncertainty, 0.00001);
            Assert.AreEqual(0.8, u2.UpperUncertainty, 0.00001);
            Assert.IsTrue(u2.IsRelative);
        }
        public void TestUncertaintyMultiplyConstantRelative()
        {
            var u1 = Uncertainty.FromPercentage(8, 0.2, 0.3);
            var u2 = u1.Multiply(2);

            Assert.AreEqual(u2, u1 * 2);
            Assert.AreEqual(u2, 2 * u1);
            Assert.AreEqual(16, u2.Value);
            Assert.AreEqual(0.2, u2.LowerPercentage, 0.00001);
            Assert.AreEqual(0.3, u2.UpperPercentage, 0.00001);
            Assert.AreEqual(3.2, u2.LowerUncertainty, 0.00001);
            Assert.AreEqual(4.8, u2.UpperUncertainty, 0.00001);
            Assert.IsTrue(u2.IsRelative);
        }
        public void TestUncertaintyToStringRelative()
        {
            var u1 = Uncertainty.FromPercentage(2, 0.05, 0.1);

            Assert.AreEqual("2 (+5%, -10%)", u1.ToString());
            Assert.AreEqual("2 (+5%, -10%)", u1.ToString("G", null));
            Assert.AreEqual("2 (+0.1, -0.2)", u1.ToString("A", null));
            Assert.AreEqual("2 (+5%, -10%)", u1.ToString("R", null));
            Assert.AreEqual("2.0 (+5.0%, -10.0%)", u1.ToString("RF1", null));
            Assert.AreEqual("2 (+5%, -10%)", u1.ToString("T", null));
            Assert.AreEqual("2", u1.ToString("V", null));
            Assert.AreEqual("(2 (+5%, -10%))", u1.ToString("B", null));
            Assert.AreEqual("2 +5%, -10%", u1.ToString("N", null));
            Assert.AreEqual("2 {0} (+5%, -10%)", u1.ToString("F", null));
        }