Esempio n. 1
0
        public void InputTest()
        {
            string[] args = { "test.asm" };
            AsmCommandLineOptions options = new AsmCommandLineOptions();

            options.ParseArgs(args);

            Assert.AreEqual(1, options.ArgsPassed);
            Assert.IsTrue(options.InputFiles.Count == 1);
            var inputFile = options.InputFiles[0];

            Assert.AreEqual("test.asm", inputFile);

            args = new string[]
            {
                "test.asm",
                "library.asm"
            };
            options = new AsmCommandLineOptions();
            options.ParseArgs(args);

            Assert.AreEqual(2, options.ArgsPassed);
            Assert.AreEqual(2, options.InputFiles.Count);
            Assert.AreEqual("test.asm", options.InputFiles[0]);
            Assert.AreEqual("library.asm", options.InputFiles[1]);
        }
Esempio n. 2
0
        /// <summary>
        /// Initialize the static members of this instance.
        /// </summary>
        public static void Initialize()
        {
            Options = new AsmCommandLineOptions();

            Evaluator = new Evaluator(false);

            Encoding = new AsmEncoding(false);

            Output = new Compilation();

            Symbols = new SymbolManager();

            Log = new ErrorLog();
        }
Esempio n. 3
0
        public void FlagOptionTest()
        {
            string[] args =
            {
                "-b",
                "--quiet"
            };
            AsmCommandLineOptions options = new AsmCommandLineOptions();

            options.ParseArgs(args);

            Assert.AreEqual(2, options.ArgsPassed);
            Assert.IsTrue(options.BigEndian);
            Assert.IsTrue(options.Quiet);
        }
Esempio n. 4
0
        /// <summary>
        /// Initialize the static members of this instance. The specified args
        /// passed will re-initialize the common Options object.
        /// </summary>
        /// <param name="args">The commandline arguments.</param>
        public static void Initialize(string[] args)
        {
            Options = new AsmCommandLineOptions();

            Options.ParseArgs(args);

            Evaluator = new Evaluator(Options.CaseSensitive);

            Encoding = new AsmEncoding(Options.CaseSensitive);

            Output = new Compilation();

            Symbols = new SymbolManager();

            Log = new ErrorLog();
        }
Esempio n. 5
0
        public void OneArgumentTest()
        {
            string[] args =
            {
                "test.a65",
                "-o",
                "test.bin"
            };
            AsmCommandLineOptions options = new AsmCommandLineOptions();

            options.ParseArgs(args);

            Assert.AreEqual(3, options.ArgsPassed);
            Assert.AreEqual(1, options.InputFiles.Count);
            Assert.AreEqual("test.a65", options.InputFiles[0]);
            Assert.AreEqual("test.bin", options.OutputFile);
        }
Esempio n. 6
0
        public void MultipleOptionTest()
        {
            string[] args =
            {
                "library.a65",
                "game.a65",
                "-o",
                "game.prg",
                "-D",
                "DEBUG",
                "=",
                "true",
                "VERSION=1.0",
                "--cpu",
                "6502i",
                "--list=game_list.a65",
                "-a",
                "--werror",
                "-l",
                "symbols.a65"
            };
            AsmCommandLineOptions options = new AsmCommandLineOptions();

            options.ParseArgs(args);

            Assert.AreEqual(14, options.ArgsPassed);
            Assert.AreEqual(2, options.InputFiles.Count);
            Assert.AreEqual("library.a65", options.InputFiles[0]);
            Assert.AreEqual("game.a65", options.InputFiles[1]);
            Assert.AreEqual("game.prg", options.OutputFile);
            Assert.AreEqual(2, options.LabelDefines.Count);
            Assert.AreEqual("DEBUG=true", options.LabelDefines[0]);
            Assert.AreEqual("VERSION=1.0", options.LabelDefines[1]);
            Assert.AreEqual("6502i", options.CPU);
            Assert.AreEqual("game_list.a65", options.ListingFile);
            Assert.IsTrue(options.NoAssembly);
            Assert.IsTrue(options.WarningsAsErrors);
            Assert.AreEqual("symbols.a65", options.LabelFile);
        }
Esempio n. 7
0
        public void MultipleArgumentTest()
        {
            string[] args =
            {
                "test1.a65",
                "test2.a65",
                "--define",
                "chrout=$ffd2",
                "chrin=$ffcf"
            };
            AsmCommandLineOptions options = new AsmCommandLineOptions();

            options.ParseArgs(args);

            Assert.AreEqual(5, options.ArgsPassed);
            Assert.AreEqual(2, options.InputFiles.Count);
            Assert.AreEqual("test1.a65", options.InputFiles[0]);
            Assert.AreEqual("test2.a65", options.InputFiles[1]);
            Assert.AreEqual(2, options.LabelDefines.Count);
            Assert.AreEqual("chrout=$ffd2", options.LabelDefines[0]);
            Assert.AreEqual("chrin=$ffcf", options.LabelDefines[1]);
        }
        public TestController(string[] args)
        {
            Output = new Compilation(true);

            Options = new AsmCommandLineOptions();

            Log = new ErrorLog();

            Evaluator = new Evaluator();

            Encoding = new AsmEncoding();

            Evaluator.DefineSymbolLookup(@"(?<=\B)'(.+)'(?=\B)", GetCharValue);

            Evaluator.DefineSymbolLookup(@"(?<=^|[^a-zA-Z0-9_.$])(?>(_+[a-zA-Z0-9]|[a-zA-Z])(\.[a-zA-Z_]|[a-zA-Z0-9_])*)(?=[^(.]|$)", GetSymbol);

            if (args != null)
            {
                Options.ProcessArgs(args);
            }
            Symbols = new SymbolManager(this);
        }