Beispiel #1
0
        public void VariableUninitialized()
        {
            LolCodeBlock blk = new LolCodeBlock();

            blk.AddVariable("abc");
            LolCodeValue tmp = blk.GetVariable("abc");

            Assert.AreEqual(null, tmp.ValueType);
        }
Beispiel #2
0
        public void VariableSearch()
        {
            LolCodeBlock blk = new LolCodeBlock();
            LolCodeBlock chl_blk = new LolCodeBlock(blk);

            LolCodeValue tmp = (LolCodeValue)10;

            blk.AddVariable("abc");
            blk.SetVariable("abc", tmp);

            Assert.AreSame(tmp, blk.GetVariable("abc"), "set main, get main");
            Assert.AreSame(tmp, chl_blk.GetVariable("abc"), "set main, get child");

            tmp = (LolCodeValue)20;

            chl_blk.AddVariable("def");
            chl_blk.SetVariable("def", tmp);

            Assert.AreSame(tmp, blk.GetVariable("def"), "set child, get main");
            Assert.AreSame(tmp, chl_blk.GetVariable("def"), "set child, get child");
        }