예제 #1
0
        public void Refresh_OK_ab_bb()
        {
            // 状態A or Bから状態Bへの変化条件が登録済みのため動作する
            int lambdaCheck = 0;

            VEFD func = () => { lambdaCheck++; };

            VE[] list =
            {
                new VE(
                    VE.HeadOr("a", "b"),
                    "b",
                    VE.Func(func))
            };
            ins = new TW_StateVector("Refresh_OK_ab_bb", "a", list);
            ins.EnableRefreshTrace = true;
            ins.Refresh("b");
            Assert.AreEqual(1, lambdaCheck);
            ins.Refresh("b");
            Assert.AreEqual(2, lambdaCheck);
        }
예제 #2
0
        public void Refresh_NG_aa()
        {
            // 状態Aから状態Aへの変化条件(状態A維持)は未登録のため動作しない
            int lambdaCheck = 0;

            VE[] list =
            {
                new VE("a", "b", /* ラムダ式 */ () => { lambdaCheck = 1; })
            };
            ins = new TW_StateVector("a", list);
            ins.Refresh("a");
            Assert.AreEqual(0, lambdaCheck);
        }
예제 #3
0
        public void Refresh_OK_ab_ac()
        {
            // 状態Aから状態B or Cへの変化条件が登録済みのため動作する
            int lambdaCheck = 0;

            VEFD func = () => { lambdaCheck++; };

            VE[] list =
            {
                new VE(
                    "a",
                    VE.TailOr("b","c"),
                    func)
            };
            ins = new TW_StateVector("Refresh_OK_ab_ac", "a", list);
            ins.EnableRefreshTrace = true;
            ins.Refresh("b");
            Assert.AreEqual(1, lambdaCheck);
            ins.StateNow = "a";
            ins.Refresh("c");
            Assert.AreEqual(2, lambdaCheck);
        }
예제 #4
0
        public void Refresh_NG_cc()
        {
            //条件を追加していない状態Cでは動作しない
            int lambdaCheck = 0;

            VE[] list =
            {
                new VE("a", "b", /* ラムダ式 */ () => { lambdaCheck = 1; })
            };
            ins = new TW_StateVector("a", list);

            ins.StateNow = ("c");
            ins.Refresh("b");
            Assert.AreEqual(0, lambdaCheck);
        }
예제 #5
0
        public void Refresh_OK_regexp()
        {
            int lambdaCheck = 0;

            VEFD func = () => { lambdaCheck = 1; };//<Refresh_OK_ab>g__func|0

            VE[] list =
            {
                new VE(@".*", @"[bc]", func)
            };
            ins = new TW_StateVector("a", list);
            ins.EnableRefreshTrace = true;
            ins.EnableRegexp       = true;
            ins.Refresh("b");
            Assert.AreEqual(1, lambdaCheck);
        }
예제 #6
0
        public void Refresh_OK_ab()
        {
            // 状態Aから状態Bへの変化条件が登録済みのため動作する
            int lambdaCheck = 0;

            VEFD func = () => { lambdaCheck = 1; };

            VE[] list =
            {
                new VE("a", "b", () => { lambdaCheck = 1; }),
                new VE("a", "b", func),
                new VE("a", "b", NameCheckFunc)
            };
            ins = new TW_StateVector("Refresh_OK_ab", "a", list);
            ins.EnableRefreshTrace = true;
            ins.Refresh("b");
            Assert.AreEqual(1, lambdaCheck);
        }
예제 #7
0
        public void Refresh_OK_ab_FuncList()
        {
            // 状態Aから状態Bへの変化条件が登録済みのため動作する
            int lambdaCheck = 0;

            VEFD func = () => { lambdaCheck = 1; };//<Refresh_OK_ab>g__func|0

            VE[] list =
            {
                new VE("a", "b",
                       VE.Func(() => { lambdaCheck = 1; }), /* <Refresh_OK_ab>b__1 */
                       func,                                /* <Refresh_OK_ab_FuncList>b__0 */
                       NameCheckFunc,                       /* NameCheckFunc */
                       () => { lambdaCheck = 1; } /* <Refresh_OK_ab_FuncList>b__2 */)
            };
            ins = new TW_StateVector("Refresh_OK_ab_FuncList", "a", list);
            ins.EnableRefreshTrace = true;
            ins.Refresh("b");
            Assert.AreEqual(1, lambdaCheck);
        }