Esempio n. 1
0
        public void StaticLibrary_LibraryPaths()
        {
            var arguments = new LinkArguments();

            arguments.TargetType         = LinkTarget.StaticLibrary;
            arguments.TargetArchitecture = "x64";
            arguments.TargetFile         = new Path("Library.mock.lib");
            arguments.ObjectFiles        = new List <Path>()
            {
                new Path("File.mock.o"),
            };
            arguments.LibraryPaths = new List <Path>()
            {
                new Path("../libraries/"),
            };

            var actualArguments = ArgumentBuilder.BuildLinkerArguments(arguments);

            var expectedArguments = new List <string>()
            {
                "/nologo",
                "/machine:X64",
                "/libpath:\"../libraries/\"",
                "/out:\"./Library.mock.lib\"",
                "./File.mock.o",
            };

            Assert.Equal(expectedArguments, actualArguments);
        }
Esempio n. 2
0
        public void WindowsApplication()
        {
            var arguments = new LinkArguments();

            arguments.TargetType         = LinkTarget.WindowsApplication;
            arguments.TargetArchitecture = "x64";
            arguments.TargetFile         = new Path("out/Something.exe");
            arguments.ObjectFiles        = new List <Path>()
            {
                new Path("File.mock.obj"),
            };
            arguments.LibraryFiles = new List <Path>()
            {
                new Path("Library.mock.lib"),
            };

            var actualArguments = ArgumentBuilder.BuildLinkerArguments(arguments);

            var expectedArguments = new List <string>()
            {
                "/nologo",
                "/subsystem:windows",
                "/machine:X64",
                "/out:\"./out/Something.exe\"",
                "./Library.mock.lib",
                "./File.mock.obj",
            };

            Assert.Equal(expectedArguments, actualArguments);
        }
Esempio n. 3
0
        public void DynamicLibrary()
        {
            var arguments = new LinkArguments();

            arguments.TargetType         = LinkTarget.DynamicLibrary;
            arguments.TargetArchitecture = "x64";
            arguments.TargetFile         = new Path("Library.mock.dll");
            arguments.ImplementationFile = new Path("Library.mock.lib");
            arguments.ObjectFiles        = new List <Path>()
            {
                new Path("File.mock.obj"),
            };

            var actualArguments = ArgumentBuilder.BuildLinkerArguments(arguments);

            var expectedArguments = new List <string>()
            {
                "/nologo",
                "/subsystem:console",
                "/dll",
                "/implib:\"./Library.mock.lib\"",
                "/machine:X64",
                "/out:\"./Library.mock.dll\"",
                "./File.mock.obj",
            };

            Assert.Equal(expectedArguments, actualArguments);
        }
Esempio n. 4
0
        public void EmptyTargetFile_Throws()
        {
            var arguments = new LinkArguments();

            arguments.TargetType  = LinkTarget.StaticLibrary;
            arguments.TargetFile  = new Path("");
            arguments.ObjectFiles = new List <Path>()
            {
                new Path("File.mock.obj"),
            };
            Assert.Throws <InvalidOperationException>(() => {
                var actualArguments = ArgumentBuilder.BuildLinkerArguments(arguments);
            });
        }
Esempio n. 5
0
        public void ZeroObjectFiles()
        {
            var arguments = new LinkArguments()
            {
                TargetType         = LinkTarget.StaticLibrary,
                TargetArchitecture = "x64",
                TargetFile         = new Path("Library.mock.lib"),
                ObjectFiles        = new List <Path>(),
            };

            var actualArguments = ArgumentBuilder.BuildLinkerArguments(arguments);

            var expectedArguments = new List <string>()
            {
                "/nologo",
                "/machine:X64",
                "/out:\"./Library.mock.lib\"",
            };

            Assert.Equal(expectedArguments, actualArguments);
        }