예제 #1
0
        private static void ConfirmEvaluate(MySheet ms, String cellRefText, double expectedValue)
        {
            ValueEval v = ms.EvaluateCell(cellRefText);

            Assert.AreEqual(typeof(NumberEval), v.GetType());
            Assert.AreEqual(expectedValue, ((NumberEval)v).NumberValue, 0.0);
        }
예제 #2
0
        public void TestRedundantUpdate()
        {
            MySheet ms = new MySheet();

            ms.SetCellValue("B1", 12);
            ms.SetCellValue("C1", 13);
            ms.SetCellFormula("A1", "B1+C1");

            // Evaluate twice to Confirm caching looks OK
            ms.EvaluateCell("A1");
            ms.GetAndClearLog();
            ConfirmEvaluate(ms, "A1", 25);
            ConfirmLog(ms, new String[] {
                "hit A1 25",
            });

            // Make redundant update, and check re-evaluation
            ms.SetCellValue("B1", 12); // value didn't change
            ConfirmLog(ms, new String[] { });
            ConfirmEvaluate(ms, "A1", 25);
            ConfirmLog(ms, new String[] {
                "hit A1 25",
            });

            ms.SetCellValue("B1", 11); // value changing
            ConfirmLog(ms, new String[] {
                "Clear B1 11",
                "Clear1 A1 25",                 // expect consuming formula cached result to Get Cleared
            });
            ConfirmEvaluate(ms, "A1", 24);
            ConfirmLog(ms, new String[] {
                "start A1 B1+C1",
                "hit B1 11",
                "hit C1 13",
                "end A1 24",
            });
        }