Beispiel #1
0
        public void Squares_Success()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + ValidSource + @"Squares.txt");
            //Assert
            Assert.AreEqual(0, run.ErrorsForTests.Count);
        }
Beispiel #2
0
        public void StatementAfterProgram_Fail()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + SyntaxErrors + @"statementAfterProgram.txt");
            //Assert
            Assert.AreEqual(1, run.ErrorsForTests.Count);
        }
Beispiel #3
0
        public void TrailingDeclarationComma_Fail()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + SyntaxErrors + @"trailingDeclarationComma.txt");
            //Assert
            Assert.AreEqual(1, run.ErrorsForTests.Count);
        }
Beispiel #4
0
        public void NoWithOrVariables_Fail()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + SyntaxErrors + @"noWithOrVariables.txt");
            //Assert
            Assert.AreEqual(1, run.ErrorsForTests.Count);
        }
Beispiel #5
0
        public void ValueAssignment_Fail()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + SyntaxErrors + @"rvalueAssignment.txt");
            //Assert
            Assert.AreEqual(2, run.ErrorsForTests.Count);
        }
Beispiel #6
0
        public void NoProgramName_Fail()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + SyntaxErrors + @"noprogname.pal.txt");
            //Assert
            Assert.AreEqual(1, run.ErrorsForTests.Count);
        }
Beispiel #7
0
        public void NonExistentType_Fail()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + SyntaxErrors + @"nonexistentType.txt");
            //Assert
            Assert.AreEqual(2, run.ErrorsForTests.Count);
        }
Beispiel #8
0
        public void NoBooleanConditional_Fail()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + SyntaxErrors + @"nonBooleanConditional.txt");
            //Assert
            Assert.AreEqual(1, run.ErrorsForTests.Count);
        }
Beispiel #9
0
        public void ExpressionTypeMissmatch_Fail()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + SemanticErrors + @"expressionTypeMismatch.txt");
            //Assert
            Assert.AreEqual(3, run.ErrorsForTests.Count);
        }
Beispiel #10
0
        public void VariableReDeclaration_Fail()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + SemanticErrors + @"variable-redeclaration.txt");
            //Assert
            Assert.AreEqual(2, run.ErrorsForTests.Count);
        }
Beispiel #11
0
        public void OUTPUTMissingIdentifiers_Fail()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + GwydMissingKeywords + @"OUTPUTMissingIdentifiers.txt");
            //Assert
            Assert.AreEqual(1, run.ErrorsForTests.Count);
        }
Beispiel #12
0
        public void InvalidIdent_Fail()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + SyntaxErrors + @"invalidident.pal.txt");
            //Assert
            Assert.AreEqual(2, run.ErrorsForTests.Count);
        }
Beispiel #13
0
        public void UNTILMissingExpression_Fail()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + GwydMissingKeywords + @"UNITLMissingExpression.txt");
            //Assert
            Assert.AreEqual(1, run.ErrorsForTests.Count);
        }
Beispiel #14
0
        public void MissingWITH_Fail()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + GwydMissingKeywords + @"MissingWith.txt");
            //Assert
            Assert.AreEqual(1, run.ErrorsForTests.Count);
        }
Beispiel #15
0
        public void MissingELSE_Success()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + GwydMissingKeywords + @"MissingELSE.txt");
            //Assert
            Assert.AreEqual(0, run.ErrorsForTests.Count);
        }
Beispiel #16
0
        public void GwydTestFile_Success()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + @"validDeclarations.txt");
            //Assert
            Assert.AreEqual(0, run.ErrorsForTests.Count);
        }
Beispiel #17
0
        public void WithButNoVariables_Success()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + @"WithButNoVariables.txt");
            //Assert
            Assert.AreEqual(0, run.ErrorsForTests.Count);
        }
Beispiel #18
0
        public void UndeclaredIdentiferIn_LOOP_Fail()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + @"Invalid_UndeclaredIdentifierIn_Loop.txt");
            //Assert
            Assert.AreEqual(3, run.ErrorsForTests.Count);
        }
Beispiel #19
0
        public void Valid1_NoWhitespaceForNonKeywords_Success()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + @"valid1_NoWhitespaceForNonKeywords.txt");
            //Assert
            Assert.AreEqual(0, run.ErrorsForTests.Count);
        }
Beispiel #20
0
        public void MissingStatements_Fail()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + SyntaxErrors + @"missingStatements.txt");
            //Assert
            Assert.AreEqual(1, run.ErrorsForTests.Count);
        }
Beispiel #21
0
        public void Invalid_Invalid_IntAssignedToReal_Fail()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + @"Invalid_IntAssignedToReal.txt");
            PrintErrorsFromRun(run);
            //Assert
            Assert.AreEqual(1, run.ErrorsForTests.Count);
        }
Beispiel #22
0
        public void EmptyFile_Fail()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + @"EmptyFile.txt");
            PrintErrorsFromRun(run);
            //Assert
            Assert.AreEqual(1, run.ErrorsForTests.Count);
        }
Beispiel #23
0
        public void GwydTestFile_VarNotDeclared_Invalid()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + @"GwydInvalid_NotDeclared.txt");
            PrintErrorsFromRun(run);
            //Assert
            Assert.AreEqual(2, run.ErrorsForTests.Count);
        }
Beispiel #24
0
        public void GwydTestFile_Invalid_AlreadyDeclared_RealInline_Invalid()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + @"Invalid_AlreadyDeclared_RealInline.txt");
            PrintErrorsFromRun(run);
            //Assert
            Assert.AreEqual(1, run.ErrorsForTests.Count);
        }
Beispiel #25
0
        public void Invalid2_Success()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

            //Act
            run.Execute(SourceFolder + @"invalid2.txt");
            PrintErrorsFromRun(run);
            //Assert
            Assert.AreEqual(5, run.ErrorsForTests.Count);
        }