Beispiel #1
0
        public void LFIsWhitespaceTest()
        {
            string line   = "(parse-whitespace \"\n\" 0)";
            string result = HighLevel.Evaluate(line, TraceLevel.Error, env);

            Assert.AreEqual("(1 \"Whitespace\" (1 \"LF\" \"\n\"))", result);
        }
Beispiel #2
0
        public void TestMultOneArgument()
        {
            string expr   = "(* 2)";
            string result = HighLevel.Evaluate(expr);

            Assert.AreEqual("2", result);
        }
Beispiel #3
0
        public void TestDivThreeArguments()
        {
            string expr   = "(/ 8 2 2)";
            string result = HighLevel.Evaluate(expr);

            Assert.AreEqual("2", result);
        }
Beispiel #4
0
        public void TestParseStringSingleChar()
        {
            string line   = "(parse-string \"String\" \"o\" \"Hello\" 4)";
            string result = HighLevel.Evaluate(line, TraceLevel.Error, env);

            Assert.AreEqual("(5 \"String\" \"o\")", result);
        }
Beispiel #5
0
        public void TestPlusMultilevel()
        {
            string expr   = "(+ 1 (+ 1 1))";
            string result = HighLevel.Evaluate(expr);

            Assert.AreEqual("3", result);
        }
Beispiel #6
0
        public void TestInc()
        {
            string line   = "(inc 3)";
            string result = HighLevel.Evaluate(line);

            Assert.AreEqual("4", result);
        }
Beispiel #7
0
        public void TestParseStringRange()
        {
            string line   = "(parse-string-range \"String\" \"A\" \"Z\" \"HEllo\" 0)";
            string result = HighLevel.Evaluate(line, TraceLevel.Error, env);

            Assert.AreEqual("(2 \"String\" \"HE\")", result);
        }
Beispiel #8
0
        public void TestUnwrapListTwoStrings()
        {
            string result = HighLevel.Evaluate("(list-unwrap (list \"Value1\" \"Value2\"))", TraceLevel.Error, env);

            Console.WriteLine(result);
            Assert.AreEqual("(\"Value1\" \"Value2\")", result);
        }
Beispiel #9
0
        public void TestUnwrapEmptyList()
        {
            string result = HighLevel.Evaluate("(list-unwrap (NIL))", TraceLevel.Error, env);

            Console.WriteLine(result);
            Assert.AreEqual("NIL", result);
        }
Beispiel #10
0
        public void CreateDictTest()
        {
            string input  = "(dict)";
            string result = HighLevel.Evaluate(input);

            Assert.AreEqual("(dict)", result);
        }
Beispiel #11
0
        public void TestUnwrapString()
        {
            string result = HighLevel.Evaluate("(list-unwrap \"Value\")", TraceLevel.Error, env);

            Console.WriteLine(result);
            Assert.AreEqual("\"Value\"", result);
        }
Beispiel #12
0
        public void GetKeysTest()
        {
            string input  = "(keys-dict (add-dict (dict) \"Key\" \"Value\"))";
            string result = HighLevel.Evaluate(input);

            Assert.AreEqual("(\"Key\" . NIL)", result);
        }
Beispiel #13
0
        public void ReadDictTest()
        {
            string input  = "(read-dict (add-dict (dict) \"Key\" \"Value\") \"Key\")";
            string result = HighLevel.Evaluate(input);

            Assert.AreEqual("\"Value\"", result);
        }
Beispiel #14
0
        public void AddDictTest()
        {
            string input  = "(add-dict (dict) \"Key\" \"Value\")";
            string result = HighLevel.Evaluate(input);

            Assert.AreEqual("(dict (\"Key\":\"Value\"))", result);
        }
Beispiel #15
0
        public void TestSimpleEqualsTrue()
        {
            string expr   = "(= 2 2)";
            string result = HighLevel.Evaluate(expr);

            Assert.AreEqual("True", result);
        }
Beispiel #16
0
        public void TestSquashSingleChild()
        {
            string result = HighLevel.Evaluate("(squash \"Y\" (quote (1 \"X\" (1 \"Y\" \"text\")) ))", TraceLevel.Error, env);

            Console.WriteLine(result);
            Assert.AreEqual("(1 \"X\" NIL)", result);
        }
Beispiel #17
0
        public void TestSimpleLoop()
        {
            string line   = "(loop print (list 1 2 3) )";
            string result = HighLevel.Evaluate(line);

            Assert.AreEqual("NIL", result);
        }
Beispiel #18
0
        public void TestSquashFirstChildHit()
        {
            string result = HighLevel.Evaluate("(squash \"Y\" (quote (10 \"X\" ((5 \"Y\" \"ytext\") (10 \"Z\" \"ztext\"))) ))", TraceLevel.Error, env);

            Console.WriteLine(result);
            Assert.AreEqual("(10 \"X\" (10 \"Z\" \"ztext\"))", result);
        }
Beispiel #19
0
        public void TestDec()
        {
            string line   = "(dec 3)";
            string result = HighLevel.Evaluate(line);

            Assert.AreEqual("2", result);
        }
Beispiel #20
0
        public void SimplePrintTest()
        {
            string input  = "(print \"Hello\")";
            string result = HighLevel.Evaluate(input);

            Assert.AreEqual("NIL", result);
        }
Beispiel #21
0
        public void TestParseStringRangeNothingToParse()
        {
            string line   = "(parse-string-range \"String\" \"a\" \"z\" \"HEllo\" 0)";
            string result = HighLevel.Evaluate(line, TraceLevel.Error, env);

            Assert.AreEqual("NIL", result);
        }
Beispiel #22
0
        public void TestQuoteEvaluationMacro()
        {
            string line   = "(quote (inc 1))";
            string result = HighLevel.Evaluate(line);

            Assert.AreEqual("(+ 1 1)", result);
        }
Beispiel #23
0
        public void TestPlusFiveArguments()
        {
            string expr   = "(+ 1 2 3 4 5)";
            string result = HighLevel.Evaluate(expr);

            Assert.AreEqual("15", result);
        }
Beispiel #24
0
        public void TestEvalQuoteEvaluation()
        {
            string expr   = "(eval (quote (+ 5 4)))";
            string result = HighLevel.Evaluate(expr);

            Assert.AreEqual("9", result);
        }
Beispiel #25
0
        public void TestMinusTwoArguments()
        {
            string expr   = "(- 3 1)";
            string result = HighLevel.Evaluate(expr);

            Assert.AreEqual("2", result);
        }
Beispiel #26
0
        public void TestSimpleStringEqualsFalse()
        {
            string expr   = "(= \"Hello\" \"Hi\")";
            string result = HighLevel.Evaluate(expr);

            Assert.AreEqual("False", result);
        }
Beispiel #27
0
        public void TestMultThreeArguments()
        {
            string expr   = "(* 3 4 5)";
            string result = HighLevel.Evaluate(expr);

            Assert.AreEqual("60", result);
        }
Beispiel #28
0
        public void TestSimpleGreaterFalse2()
        {
            string expr   = "(> 3 3)";
            string result = HighLevel.Evaluate(expr);

            Assert.AreEqual("False", result);
        }
Beispiel #29
0
        public void TestPlusTwoArguments()
        {
            string expr   = "(+ 1 2)";
            string result = HighLevel.Evaluate(expr);

            Assert.AreEqual("3", result);
        }
Beispiel #30
0
        public void TestSpaceParser()
        {
            string line   = "(parse-char \"Space\" \" \" \"A B\" 1)";
            string result = HighLevel.Evaluate(line, TraceLevel.Error, env);

            Assert.AreEqual("(2 \"Space\" \" \")", result);
        }