예제 #1
0
파일: Test.cs 프로젝트: hfoffani/hypolambda
        public void Test_ToFrom_PCode()
        {
            var e1 = new HypoLambda();
            e1.Compile("(this.A + this.B) * 5");
            Aux y1 = new Aux();
            y1.A = 2;
            y1.B = 1;
            e1.Externals["this"] = y1;
            Assert.AreEqual(15.0, Convert.ToDouble(e1.Run()));

            var pc1 = e1.ToPortablePCODE();

            var e2 = new HypoLambda();
            e2.FromPortablePCODE(pc1);
            //Compruebo la deserealizacion.
            Aux y2 = new Aux();
            y2.A = 2;
            y2.B = 1;
            e2.Externals["this"] = y2;
            Assert.AreEqual(15.0, Convert.ToDouble(e2.Run()));
        }