Example #1
0
        public void SysV_TerminatingFunction()
        {
            cfgSvc.Stub(c => c.GetInstallationRelativePath("libc.xml"))
            .Return("libc.xml");

            var env = new OperatingEnvironmentElement
            {
                TypeLibraries =
                {
                    new TypeLibraryElement
                    {
                        Name = "libc.xml"
                    }
                },
                CharacteristicsLibraries =
                {
                    new TypeLibraryElement
                    {
                        Name = "libcharacteristics.xml",
                    }
                }
            };

            Given_EnvironmentConfiguration(env);
            tlSvc.Stub(t => t.LoadCharacteristics(null))
            .IgnoreArguments()
            .Return(new CharacteristicsLibrary
            {
                Entries =
                {
                    {
                        "exit",
                        new ProcedureCharacteristics {
                            Terminates = true
                        }
                    }
                }
            });
            tlSvc.Stub(t => t.LoadMetadataIntoLibrary(null, null, null))
            .IgnoreArguments()
            .Return(new TypeLibrary
            {
                Signatures =
                {
                    {
                        "exit",
                        new FunctionType()
                    }
                }
            });
            mr.ReplayAll();

            var sysv = new SysVPlatform(sc, arch);
            var proc = sysv.LookupProcedureByName(null, "exit");

            Assert.IsTrue(proc.Characteristics.Terminates, "exit should have been marked as terminating.");
        }
Example #2
0
        private void Given_Func(string fileContents)
        {
            var stm = new MemoryStream(Encoding.ASCII.GetBytes(fileContents));

            fsSvc.Expect(f => f.CreateFileStream("exec.funcs", FileMode.Open, FileAccess.Read))
            .Return(stm);
            tllSvc.Stub(t => t.InstalledFileLocation(null)).IgnoreArguments().Return("exec.funcs");
        }