Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #16
0
        public void GwydTestFile_Success()
        {
            //Arrange
            RunCompiler run = new RunCompiler();

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

            //Act
            run.Execute(SourceFolder + @"WithButNoVariables.txt");
            //Assert
            Assert.AreEqual(0, run.ErrorsForTests.Count);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }