Exemple #1
0
        public void Initialize_Numeric_Variable_As_String_No_Exponent(string value)
        {
            PrimitiveUnit symbolicValue = new PrimitiveUnit(value);

            Assert.IsFalse(symbolicValue.IsNumber());
            Assert.IsFalse(symbolicValue.IsFloat());
            Assert.IsFalse(symbolicValue.IsInteger());
            Assert.IsFalse(symbolicValue.IsFraction());
            Assert.IsTrue(symbolicValue.IsSymbolic());

            Assert.That(symbolicValue.Label(), Is.EqualTo(string.Empty));
            Assert.That(symbolicValue.BaseLabel(), Is.EqualTo(string.Empty));
            Assert.That(symbolicValue.PowerLabel(), Is.EqualTo(string.Empty));
        }
Exemple #2
0
        public void Initialize_NonNumeric_As_String_No_Exponent(string value, string expectedBaseLabel, string expectedPowerLabel, string expectedLabel)
        {
            PrimitiveUnit symbolicValue = new PrimitiveUnit(value);

            Assert.IsFalse(symbolicValue.IsNumber());
            Assert.IsFalse(symbolicValue.IsFloat());
            Assert.IsFalse(symbolicValue.IsInteger());
            Assert.IsFalse(symbolicValue.IsFraction());
            Assert.IsTrue(symbolicValue.IsSymbolic());

            Assert.That(symbolicValue.Label(), Is.EqualTo(expectedLabel));
            Assert.That(symbolicValue.BaseLabel(), Is.EqualTo(expectedBaseLabel));
            Assert.That(symbolicValue.PowerLabel(), Is.EqualTo(expectedPowerLabel));
        }
Exemple #3
0
        public void Initialize_As_Float(double value, string exponent,
                                        string expectedBaseLabel, string expectedPowerLabel, string expectedLabel, bool isNumber, bool isFloat)
        {
            PrimitiveUnit power         = new PrimitiveUnit(exponent);
            PrimitiveUnit symbolicValue = new PrimitiveUnit(value, power);

            Assert.That(symbolicValue.IsNumber(), Is.EqualTo(isNumber));
            Assert.That(symbolicValue.IsFloat(), Is.EqualTo(isFloat));
            Assert.IsFalse(symbolicValue.IsInteger());
            Assert.IsFalse(symbolicValue.IsFraction());
            Assert.That(symbolicValue.IsSymbolic(), Is.EqualTo(!isNumber));

            Assert.That(symbolicValue.Label(), Is.EqualTo(expectedLabel));
            Assert.That(symbolicValue.BaseLabel(), Is.EqualTo(expectedBaseLabel));
            Assert.That(symbolicValue.PowerLabel(), Is.EqualTo(expectedPowerLabel));
        }