public void SetCellContents5()
        {
            TestableSpreadsheet sheet = new TestableSpreadsheet();

            Formulas.Formula f1 = new Formulas.Formula("13+a1");
            Formulas.Formula f2 = new Formulas.Formula("12+a2");
            sheet.SetCellContents("a1", "45");
            sheet.SetCellContents("a2", f1);
            sheet.SetCellContents("a1", f2);
        }
        public void SetCellContents4()
        {
            TestableSpreadsheet sheet = new TestableSpreadsheet();

            Formulas.Formula f1 = new Formulas.Formula("13+a1");
            Formulas.Formula f2 = new Formulas.Formula("a2+a1");
            sheet.SetCellContents("a1", 45);
            sheet.SetCellContents("a2", f1);
            sheet.SetCellContents("a3", f2);
            string s = "";

            foreach (string t in sheet.SetCellContents("a1", "12"))
            {
                s = s + t;
            }
            Assert.AreEqual("A1A2A3", s);
        }
 public void Test4()
 {
     Formula f = new Formula("((3+5*7)");
 }
 public void Construct3()
 {
     Formula f = new Formula("2 3");
 }
Exemple #5
0
        public void Test22a()
        {
            Formula f = new Formula("a1b2c3d4e5f6g7h8i9j10");

            Assert.AreEqual(10, f.Evaluate(s => 10), 1e-6);
        }
 public void Evaluate9()
 {
     Formula f = new Formula("(((x+y)+(z/x))*(3-1)+(5*3))");
     Assert.AreEqual(f.Evaluate(Lookup4), 39.0, 1e-6);
 }
 public void Evaluate8()
 {
     Formula f = new Formula("(x6)");
     f.Evaluate(Lookup4);
 }
 public void Test9()
 {
     Formula f = new Formula(")");
 }
 public void Test13()
 {
     Formula f = new Formula("((((((((((2)))))))))");
 }
Exemple #10
0
        public void Test29()
        {
            Formula f = new Formula("(1 + 2 + 3 * 4 + 5) * 2");

            Assert.AreEqual(40, f.Evaluate(s => 0), 1e-6);
        }
Exemple #11
0
        public void Test30()
        {
            Formula f = new Formula("((((((((((((3))))))))))))");

            Assert.AreEqual(3, f.Evaluate(s => 0), 1e-6);
        }
Exemple #12
0
        public void Test27()
        {
            Formula f = new Formula("(5 + 4) * 2");

            Assert.AreEqual(18, f.Evaluate(s => 0), 1e-6);
        }
Exemple #13
0
        public void Test28()
        {
            Formula f = new Formula("1 + 2 + 3 * 4 + 5");

            Assert.AreEqual(20, f.Evaluate(s => 0), 1e-6);
        }
Exemple #14
0
 public void Test3()
 {
     Formula f = new Formula("2+5*8)");
 }
Exemple #15
0
        public void Test26()
        {
            Formula f = new Formula("8 / xx");

            Assert.AreEqual(2, f.Evaluate(s => 4), 1e-6);
        }
Exemple #16
0
        public void Test25()
        {
            Formula f = new Formula("5 * z");

            Assert.AreEqual(20, f.Evaluate(s => 4), 1e-6);
        }
 public void Test5()
 {
     Formula f = new Formula("+3");
 }
Exemple #18
0
        public void Test31()
        {
            Formula f = new Formula("((((((((((((x))))))))))))");

            Assert.AreEqual(7, f.Evaluate(s => 7), 1e-6);
        }
 public void Test7()
 {
     Formula f = new Formula("*7");
 }
Exemple #20
0
        public void Test32()
        {
            Formula f = new Formula("y*3-8/2+4*(8-9*2)/14*x");

            Assert.AreEqual(5.14285714285714, (double)f.Evaluate(s => (s == "x") ? 1 : 4), 1e-9);
        }
 public void Test11()
 {
     Formula f = new Formula("2 5");
 }
Exemple #22
0
        public void Test32a()
        {
            Formula f = new Formula("a + b * c - d + 3 * 3.0 - 3.0e0 / 0.003e3");

            Assert.AreEqual(17, (double)f.Evaluate(s => 3), 1e-9);
        }
 public void Evaluate6()
 {
     Formula f = new Formula("(((3+2)+(4/2))*(3-1)+(5*3))");
     Assert.AreEqual(f.Evaluate(Lookup4), 29.0, 1e-6);
 }
Exemple #24
0
        public void Test33()
        {
            Formula f = new Formula("a+(b+(c+(d+(e+f))))");

            Assert.AreEqual(6, (double)f.Evaluate(s => 1), 1e-9);
        }
 public void Construct4()
 {
     Formula f = new Formula("(ciao)");
 }
Exemple #26
0
 public void Test4()
 {
     Formula f = new Formula("((3+5*7)");
 }
 public void Construct1()
 {
     Formula f = new Formula("_");
 }
Exemple #28
0
        public void Test34()
        {
            Formula f = new Formula("((((x1+x2)+x3)+x4)+x5)+x6");

            Assert.AreEqual(12, (double)f.Evaluate(s => 2), 1e-9);
        }
Exemple #29
0
        public void Test24()
        {
            Formula f = new Formula("5 - y");

            Assert.AreEqual(1, f.Evaluate(s => 4), 1e-6);
        }
Exemple #30
0
        public void Test35()
        {
            Formula f = new Formula("a-a*a/a");

            Assert.AreEqual(0, (double)f.Evaluate(s => 3), 1e-9);
        }
 public void Test36()
 {
     Formula f1 = new Formula("xx+3");
     Formula f2 = new Formula("xx-3");
     Assert.AreEqual(6, f1.Evaluate(s => 3), 1e-6);
     Assert.AreEqual(0, f2.Evaluate(s => 3), 1e-6);
 }
Exemple #32
0
 public void Test41()
 {
     Formula f = new Formula("(((((2+3*a)/(7e-5+b-c))*d+.0005e+92)-8.2)*3.14159) * ((e+3.1)-.00000000008)");
 }
 public void Test41()
 {
     Formula f = new Formula("(((((2+3*a)/(7e-5+b-c))*d+.0005e+92)-8.2)*3.14159) * ((e+3.1)-.00000000008)");
 }
Exemple #34
0
 public void Test5()
 {
     Formula f = new Formula("+3");
 }
 public void Test6()
 {
     Formula f = new Formula("-y");
 }
Exemple #36
0
 public void Test6()
 {
     Formula f = new Formula("-y");
 }
 public void Test8()
 {
     Formula f = new Formula("/z2x");
 }
Exemple #38
0
 public void Test7()
 {
     Formula f = new Formula("*7");
 }
 public void Test10()
 {
     Formula f = new Formula("(*5)");
 }
Exemple #40
0
 public void Test8()
 {
     Formula f = new Formula("/z2x");
 }
 public void Test12()
 {
     Formula f = new Formula("x5 y");
 }
Exemple #42
0
 public void Test9()
 {
     Formula f = new Formula(")");
 }
 public void Evaluate5 ()
 {
     Formula f = new Formula("(x + y) * (z / x) * 1.0");
     Assert.AreEqual(f.Evaluate(Lookup4), 20.0, 1e-6);
 }
Exemple #44
0
 public void Test10()
 {
     Formula f = new Formula("(*5)");
 }
 public void Evaluate7()
 {
     Formula f = new Formula("100.5-(4-3)-((8-3)-4)");
     Assert.AreEqual(f.Evaluate(Lookup4), 98.5, 1e-6);
 }
Exemple #46
0
 public void Test11()
 {
     Formula f = new Formula("2 5");
 }
 public void Evaluate10()
 {
     Formula f = new Formula("(((x+y)+(z/0))*(3-1)+(5*3))");
     f.Evaluate(Lookup4);
 }
Exemple #48
0
 public void Test12()
 {
     Formula f = new Formula("x5 y");
 }
 public void Construct5()
 {
     Formula f = new Formula("(-6)");
 }
Exemple #50
0
 public void Test13()
 {
     Formula f = new Formula("((((((((((2)))))))))");
 }
 public void Evaluate11()
 {
     Formula f = new Formula("(2.0000000000000000000000000000000000000000f)");
     f.Evaluate(Lookup4);
 }
 public void Evaluate2()
 {
     Formula f = new Formula("x5");
     Assert.AreEqual(f.Evaluate(v => 22.5), 22.5, 1e-6);
 }
 public void Construct2()
 {
     Formula f = new Formula("2++3");
 }
 public void Evaluate4()
 {
     Formula f = new Formula("x + y");
     Assert.AreEqual(f.Evaluate(Lookup4), 10.0, 1e-6);
 }
 public void Evaluate1()
 {
     Formula f = new Formula("2+3");
     Assert.AreEqual(f.Evaluate(v => 0), 5.0, 1e-6);
 }
Exemple #56
0
        public void Test23()
        {
            Formula f = new Formula("5 + x");

            Assert.AreEqual(9, f.Evaluate(s => 4), 1e-6);
        }
 public void Evaluate3()
 {
     Formula f = new Formula("x + y");
     f.Evaluate(v => { throw new UndefinedVariableException(v); });
 }
 public void Test35()
 {
     Formula f = new Formula("a-a*a/a");
     Assert.AreEqual(0, (double)f.Evaluate(s => 3), 1e-9);
 }
 // MODIFIED PROTECTION FOR PS6
 /// <summary>
 /// Otherwise, if name is null or invalid, throws an InvalidNameException.
 /// 
 /// Otherwise, if changing the contents of the named cell to be the formula would cause a 
 /// circular dependency, throws a CircularException.
 /// 
 /// Otherwise, the contents of the named cell becomes formula.  The method returns a
 /// Set consisting of name plus the names of all other cells whose value depends,
 /// directly or indirectly, on the named cell.
 /// 
 /// For example, if name is A1, B1 contains A1*2, and C1 contains B1+A1, the
 /// set {A1, B1, C1} is returned.
 /// </summary>
 protected abstract ISet<String> SetCellContents(String name, Formula formula);
Exemple #60
0
        public void Test22()
        {
            Formula f = new Formula("a05");

            Assert.AreEqual(10, f.Evaluate(s => 10), 1e-6);
        }