GetNew() статический приватный Метод

Creates a new ScriptProcessor.
static private GetNew ( ) : ScriptProcessor
Результат Pokemon3D.Scripting.ScriptProcessor
Пример #1
0
        public void WhileLoopTests()
        {
            var processor = ScriptProcessorFactory.GetNew();
            var result    = processor.Run("var a = 0; while (a < 10) { a++; } a;");

            Assert.IsTrue(result is SNumber);
            Assert.AreEqual(((SNumber)result).Value, 10);
        }
Пример #2
0
        public void NotEqualsTests()
        {
            SObject result    = null;
            var     processor = ScriptProcessorFactory.GetNew();

            result = processor.Run("2 != 3");

            Assert.IsTrue(result is SBool);
            Assert.AreEqual(((SBool)result).Value, true);

            result = processor.Run("2 !== 3");

            Assert.IsTrue(result is SBool);
            Assert.AreEqual(((SBool)result).Value, true);
        }
Пример #3
0
        public void SmallerThanTests()
        {
            SObject result    = null;
            var     processor = ScriptProcessorFactory.GetNew();

            result = processor.Run("2 < 3");

            Assert.IsTrue(result is SBool);
            Assert.AreEqual(((SBool)result).Value, true);

            result = processor.Run("3 < -5");

            Assert.IsTrue(result is SBool);
            Assert.AreEqual(((SBool)result).Value, false);

            result = processor.Run("\"test\" < -5");

            Assert.IsTrue(result is SBool);
            Assert.AreEqual(((SBool)result).Value, false);
        }
Пример #4
0
        public void GreaterThanOrEqualsTests()
        {
            SObject result    = null;
            var     processor = ScriptProcessorFactory.GetNew();

            result = processor.Run("3 >= 2");

            Assert.IsTrue(result is SBool);
            Assert.AreEqual(((SBool)result).Value, true);

            result = processor.Run("3 >= 3");

            Assert.IsTrue(result is SBool);
            Assert.AreEqual(((SBool)result).Value, true);

            result = processor.Run("\"test\" >= 0");

            Assert.IsTrue(result is SBool);
            Assert.AreEqual(((SBool)result).Value, false);
        }