Пример #1
0
        public void SimpleMath()
        {
            var p = new SeriesExpressionParser();

            Assert.AreEqual(4, p.Evaluate("10 - 3*2").Double);
            Assert.AreEqual(4, p.Evaluate("10 - 2 *3").Double);
            Assert.AreEqual(8, p.Evaluate("2^3").Double);
            Assert.AreEqual(8, p.Evaluate("10 - 2 * 3^0").Double);
            Assert.AreEqual(-2, p.Evaluate(" -(2+0*5)").Double);
            Assert.AreEqual(16, p.Evaluate("-2^(10-2*3)").Double);
        }
Пример #2
0
        public void ReadAndShift()
        {
            // nov 14, 1999,  250 cfs
            // nov 15, 1999   249 cfs
            Series   s      = new HydrometDailySeries("bigi", "qd");
            DateTime t      = DateTime.Parse("1999-11-15");
            int      offset = -1;

            s = SeriesExpressionParser.ReadAndShiftData(-offset, s, t, t);

            Assert.AreEqual(1, s.Count);
            Assert.AreEqual(250, s[0].Value);
            Assert.AreEqual(15, s[0].DateTime.Day);
        }
Пример #3
0
 public void Test()
 {
     CalculationSeries      s  = new CalculationSeries();
     SeriesExpressionParser p  = s.Parser;
     VariableResolver       vr = p.VariableResolver;
 }