Exemple #1
0
        public void Build_Success()
        {
            Casl2Program subProgram = Casl2Program.MakeForUnitTest(
                "SUB",
                TestUtils.MakeArray(
                    "ADDSUB  START",
                    "        ADDA  GR1,GR2",
                    "        RET",
                    "        END"));
            Casl2Program mainProgram = Casl2Program.MakeForUnitTest(
                "MAIN",
                TestUtils.MakeArray(
                    "MAIN    START",
                    "        CALL  ADDSUB",
                    "        RET",
                    "        END"));
            Casl2Project project = Casl2Project.MakeForUnitTest(subProgram, mainProgram);

            project.Programs.SelectItem(mainProgram);

            MemoryAddress expectedLoadAddress      = MemoryAddress.Zero;
            MemoryAddress expectedExecStartAddress = new MemoryAddress(2);

            Word[] expectedWords = WordTest.MakeArray(
                // Sub
                0x2412,                     //         ADDA  GR1,GR2
                0x8100,                     //         RET
                // Main
                0x8000, 0x0000,             //         CALL  ADDSUB
                0x8100);                    //         RET
            ExecutableModule expected =
                new ExecutableModule(expectedLoadAddress, expectedExecStartAddress, expectedWords);

            CheckBuild(project, expected, "ビルド成功 => 実行可能モジュールが生成される");
        }
Exemple #2
0
        public void Build_AssembleError()
        {
            Casl2Program errorProgram = Casl2Program.MakeForUnitTest(
                "ERR",
                TestUtils.MakeArray(
                    "MAIN    START",
                    "        UNDEF",        // 未定義命令
                    "        END"));
            Casl2Project project = Casl2Project.MakeForUnitTest(errorProgram);

            CheckBuild(project, null, "アセンブルエラー => 例外");
        }
Exemple #3
0
        public void Build_LinkError()
        {
            Casl2Program subProgram = Casl2Program.MakeForUnitTest(
                "SUB",
                TestUtils.MakeArray(
                    "ADDSUB  START",
                    "        ADDA  GR1,GR2",
                    "        RET",
                    "        END"));
            Casl2Program mainProgram = Casl2Program.MakeForUnitTest(
                "MAIN",
                TestUtils.MakeArray(
                    "MAIN    START",
                    "        CALL  UNDEF",      // 未定義ラベルを参照
                    "        RET",
                    "        END"));
            Casl2Project project = Casl2Project.MakeForUnitTest(subProgram, mainProgram);

            CheckBuild(project, null, "リンクエラー => 例外");
        }