Ejemplo n.º 1
0
        public void TestCompilerAndRuntimeComponent01()
        {
            String code =
                @"
a = 10;
"                           ;
            // Compile core
            var opts = new Options();

            opts.ExecutionMode = ExecutionMode.Serial;
            ProtoCore.Core core = new Core(opts);
            core.Compilers.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Compiler(core));
            core.Compilers.Add(ProtoCore.Language.kImperative, new ProtoImperative.Compiler(core));
            ProtoScriptRunner runner = new ProtoScriptRunner();

            // Compiler instance
            ProtoCore.DSASM.Executable dsExecutable;
            bool compileSucceeded = runner.CompileMe(code, core, out dsExecutable);

            Assert.IsTrue(compileSucceeded == true);

            // Pass compile data to the runtime
            RuntimeCore runtimeCore = new RuntimeCore(core.Heap);

            runtimeCore.SetProperties(core.Options, dsExecutable);

            // Runtime
            ExecutionMirror mirror = runner.ExecuteMe(runtimeCore);
            Obj             o      = mirror.GetValue("a");

            Assert.IsTrue((Int64)o.Payload == 10);
        }
Ejemplo n.º 2
0
        public void SetUp()
        {
            testCore = thisTest.SetupTestCore();

            testRuntimeCore = new RuntimeCore(testCore.Heap);
            testRuntimeCore.SetProperties(testCore.Options, null);

            testExecutive = new TestExecutive(testRuntimeCore);
        }