Exemple #1
0
        private void equationTextBox_Leave(object sender, EventArgs e)
        {
            try
            {
                Calculation c = new Calculation(equationTextBox.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Parenthesis Error", MessageBoxButtons.OK);
                return;
            }

            connection = equationTextBox.Text;
        }
        public void Parenthesis()
        {
            Calculation c = new Calculation("(2+3)*5");

            Assert.AreEqual(25.0, c.ReEval());
        }
        public void Twoparenthesis()
        {
            Calculation c = new Calculation("(3+2)/(3+2)");

            Assert.AreEqual((3.0+2.0)/(3.0+2.0), c.ReEval());
        }
        public void NoParenthesis()
        {
            Calculation c = new Calculation("2+3+5");

            Assert.AreEqual(10.0, c.ReEval());
        }
 public void MultipleParenthesis()
 {
     Calculation c = new Calculation("((1-2)/(2-4))*10");
     Assert.AreEqual(expected: ((1.0 - 2.0)/(2.0 - 4.0)) * 10.0, actual: c.ReEval());
 }
        public void LargerEq()
        {
            Calculation c = new Calculation("2^3*(1+2+3)/10+3.14159");

            Assert.AreEqual(Math.Pow(2, 3) * (1 + 2 + 3) / 10 + 3.14159, c.ReEval());
        }
Exemple #7
0
        public CCell(CCell c, List<Cell> dependencies, bool multiCell = false ) : base(c, multiCell)
        {
            _Calculation = new Calculation(ConnectionInfo);
            _Dependencies = new Dictionary<Cell, bool>();
            _CellType = CellType.C;

            // need to call copy contructors for dependencies passed from old cells


            foreach (Cell dependency in dependencies )
            {
                _Dependencies.Add(dependency, false);
            }
        }
Exemple #8
0
        public CCell(string label, int digits, int precision, string connectionInfo, int rowIndex, int columnIndex, List<Cell> dependencies ) : 
        base(label, digits, precision, connectionInfo, rowIndex, columnIndex)
        {
            _Calculation = new Calculation(ConnectionInfo);
            _Dependencies = new Dictionary<Cell, bool>();
            _CellType = CellType.C;

            foreach (Cell dependency in dependencies)
            {
                //Tuple<Cell, bool> t = new Tuple<Cell, bool>(dependency, false);
                _Dependencies.Add(dependency, false);
            }
        }