Ejemplo n.º 1
0
        public void CompileCode_ReturnsOutput()
        {
            //Arrange
            var filePath = @"..\..\..\Assets\Test Required FIles\CodeCheckerTest\Source.c";
            //Act
            var results = CodeChecker.CompileCode(filePath);

            Assert.IsNotNull(results);
        }
Ejemplo n.º 2
0
        //Run this function from Start buttun. Compile the .c code.
        //We don't pass an argument here since SingleSubmission it supposed to be contained in Submissions and it has the list.
        public void CompileSubmittedCode()
        {
            if (codeExists && Submissions.checkCode)
            {
                this.compilerOutput = CodeChecker.CompileCode(codePath);
                //If it succeeds, the new .exe file path should be this (replace ".c" with ".exe"):
                this.compiledExePath = codePath.Substring(0, codePath.Length - 2) + ".exe";
            }

            if (File.Exists(compiledExePath))
            {
                this.exeExists = true; //If it works, then we have a code.
            }
            else
            {
                this.compiledExePath = null; //If the path doesn't exist (compilation failed), remove it from saved .exe path.
            }
        }