Exemple #1
0
        public void RegisteredBooleanTypeProcedureDoesExist()
        {
            var engine   = new Engine();
            var captured = default(Object);

            TypeProcedures.Register <Boolean>(_ => (args, value) => { captured = value; });
            engine.Interpret("true(3) = 5");
            TypeFunctions.Unregister <Boolean>();
            Assert.AreEqual(5.0, captured);
        }
Exemple #2
0
        public void RegisteredBooleanTypeFunctionDoesExist()
        {
            var engine = new Engine();

            TypeFunctions.Register <Boolean>(_ => args => args[0]);
            var result = engine.Interpret("true(3)");

            TypeFunctions.Unregister <Boolean>();
            Assert.AreEqual(3.0, result);
        }