public void CallingUndefinedFunction()
        {
            TextReader programString = new StringReader("f()");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            //program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Can't find function with name f",
                program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void AssignmentWithNoExpression2()
        {
            TextReader programString = File.OpenText("code33.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Missing expression in assignment",
                program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void DeclareVariableTwice()
        {
            TextReader programString = File.OpenText("code39.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            //program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Trying to redefine symbol with name a",
                program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void DefiningVariableWithUnknownType()
        {
            TextReader programString = new StringReader("superinteger a");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            //program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Can't find type with name superinteger",
                program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void FunctionCallWithMissedParanthesis2()
        {
            TextReader         programString = new StringReader("f(a");
            DefaultSprakRunner program       = new DefaultSprakRunner(programString);

            program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Ending parenthesis is missing in function call",
                            program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void UsingReservedWordAsVariableName()
        {
            TextReader         programString = File.OpenText("code34.txt");
            DefaultSprakRunner program       = new DefaultSprakRunner(programString);

            program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Can't figure out statement type of token BUILT_IN_TYPE with string float",
                            program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void IfStatementWithMissedParenthesis()
        {
            TextReader         programString = new StringReader("if(a > b { }");
            DefaultSprakRunner program       = new DefaultSprakRunner(programString);

            program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("If statement isn't complete",
                            program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void DeclareVariableTwice()
        {
            TextReader         programString = File.OpenText("code39.txt");
            DefaultSprakRunner program       = new DefaultSprakRunner(programString);

            //program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Trying to redefine symbol with name a",
                            program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void FunctionCallWithMissedParanthesis()
        {
            TextReader         programString = new StringReader("f(");
            DefaultSprakRunner program       = new DefaultSprakRunner(programString);

            program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Something is wrong with the argument list",
                            program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void FunctionCallWithMissedCommaInArgumentList()
        {
            TextReader         programString = new StringReader("f(a b)");
            DefaultSprakRunner program       = new DefaultSprakRunner(programString);

            program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Comma is missing in argument list",
                            program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void DefiningVariableWithUnknownType()
        {
            TextReader         programString = new StringReader("superinteger a");
            DefaultSprakRunner program       = new DefaultSprakRunner(programString);

            //program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Can't find type with name superinteger",
                            program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void CallingUndefinedFunction()
        {
            TextReader         programString = new StringReader("f()");
            DefaultSprakRunner program       = new DefaultSprakRunner(programString);

            //program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Can't find function with name f",
                            program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void AssignmentWithNoExpression2()
        {
            TextReader         programString = File.OpenText("code33.txt");
            DefaultSprakRunner program       = new DefaultSprakRunner(programString);

            program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Missing expression in assignment",
                            program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void FunctionDefinitionWithoutEndingBracket()
        {
            TextReader         programString = File.OpenText("code38.txt");
            DefaultSprakRunner program       = new DefaultSprakRunner(programString);

            program.run();
            program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Trying to define a function inside a function (are you missing a curly bracket?)",
                            program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void FunctionDefinitionWithoutBody()
        {
            TextReader         programString = File.OpenText("code37.txt");
            DefaultSprakRunner program       = new DefaultSprakRunner(programString);

            program.run();
            program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Missing curly bracket in beginning of function definition",
                            program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void WrongNumberOfArgumentsToFunction()
        {
            TextReader         programString = File.OpenText("code30.txt");
            DefaultSprakRunner program       = new DefaultSprakRunner(programString);

            program.run();
            //program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Wrong number of arguments to function",
                            program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void IfStatementWithStrangeConditional()
        {
            TextReader programString = new StringReader("if(a, b) { }");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("If statement isn't complete",
                program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void UsingReservedWordAsVariableName()
        {
            TextReader programString = File.OpenText("code34.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Can't figure out statement type of token BUILT_IN_TYPE with string float",
                program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void FunctionCallWithMissedParanthesis2()
        {
            TextReader programString = new StringReader("f(a");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Ending parenthesis is missing in function call",
                program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void FunctionDefinitionWithoutBody()
        {
            TextReader programString = File.OpenText("code37.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();
            program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Missing curly bracket in beginning of function definition",
                program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void FunctionDefinitionWithoutEndingBracket()
        {
            TextReader programString = File.OpenText("code38.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();
            program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Trying to define a function inside a function (are you missing a curly bracket?)",
                program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void IfStatementWithMissingEndBlock()
        {
            TextReader programString = new StringReader("if(a == b) { print(42) ");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("If statement isn't complete",
                program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void WrongNumberOfArgumentsToFunction()
        {
            TextReader programString = File.OpenText("code30.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();
            //program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Wrong number of arguments to function",
                program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void FunctionCallWithMissedCommaInArgumentList()
        {
            TextReader programString = new StringReader("f(a b)");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Comma is missing in argument list",
                program.getErrorHandler().getErrors()[0].getMessage());
        }
        public void FunctionCallWithMissedParanthesis()
        {
            TextReader programString = new StringReader("f(");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.getErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getErrorHandler().getErrors().Count);
            Assert.AreEqual("Something is wrong with the argument list",
                program.getErrorHandler().getErrors()[0].getMessage());
        }