Exemplo n.º 1
0
        public void SerializeAndExecute(string pattern)
        {
            var ms     = new MemoryStream();
            var pgmSer = RantProgram.CompileString(pattern);

            pgmSer.SaveToStream(ms);
            ms.Seek(0, SeekOrigin.Begin);
            var pgmDeser    = RantProgram.LoadStream("Test", ms);
            var resultSer   = rant.Do(pgmSer, seed: 0).Main;
            var resultDeser = rant.Do(pgmDeser, seed: 0).Main;

            Console.WriteLine($"Before: '{resultSer}'");
            Console.WriteLine($"After: '{resultDeser}'");
            Assert.AreEqual(resultSer, resultDeser);
        }