public void Interpreter_FilterTest() { var interpreter = new Interpreter("“string“起当's", new VObject[0]); var result = new VObject(interpreter.Interpret()); var expected = new List <VObject> { "s" }; Assert.IsTrue(result.Equals(new VObject(expected)), result.Dump()); }
public void Interpreter_Number() { var interpreter = new Interpreter("22222", new VObject[0]); var result = new VObject(interpreter.Interpret()); var expected = new List <VObject> { new VObject(22222) }; Assert.IsTrue(result.Equals(new VObject(expected)), result.Dump()); }
public void Interpreter_String() { var interpreter = new Interpreter("“Hello, World!", new VObject[0]); var result = new VObject(interpreter.Interpret()); var expected = new List <VObject> { new VObject("Hello, World!") }; Assert.IsTrue(result.Equals(new VObject(expected)), result.Dump()); }
public void Interpreter_NumberUnaryFunctions(string program, object[] expected, object[] inputs = null) { inputs ??= new object[0]; var vInputs = inputs.Select(x => new VObject(x)).ToArray(); var vExpected = new VObject(expected.Select(x => new VObject(x)).ToList()); var interpreter = new Interpreter(program, vInputs); var result = new VObject(interpreter.Interpret()); Assert.IsTrue(result.Equals(vExpected), result.Dump()); }
public void Interpreter_LambdaTest() { var interpreter = new Interpreter("点最因中", new VObject[] { "string" }); var result = new VObject(interpreter.Interpret()); var expected = new List <VObject> { new List <VObject> { "t", "u", "s", "j", "o", "h" } }; Assert.IsTrue(result.Equals(new VObject(expected)), result.Dump()); }
public void Interpreter_PairLambda() { var interpreter = new Interpreter("电如3了5", new VObject[] { }); var result = new VObject(interpreter.Interpret()); var expected = new List <VObject> { Enumerable.Repeat(new VObject(new List <VObject> { 3, 5 }), 100).ToList() }; Assert.IsTrue(result.Equals(new VObject(expected)), result.Dump()); }
public void Interpreter_HigherOrderTiers() { var interpreter = new Interpreter("j因j因", new VObject[] { new List <VObject> { 1, 2, 3 } }); var result = new VObject(interpreter.Interpret()); var expected = new List <VObject> { new List <VObject> { 3, 4, 5 } }; Assert.IsTrue(result.Equals(new VObject(expected)), result.Dump()); }
public void Interpreter_LambdaParameterTest() { var interpreter = new Interpreter("点斯J起它不1", new VObject[] { new List <VObject> { new List <VObject> { 1, 2 } } }); var result = new VObject(interpreter.Interpret()); var expected = new List <VObject> { new List <VObject> { new List <VObject> { 1 } } }; Assert.IsTrue(result.Equals(new VObject(expected)), result.Dump()); }