static void Main(string[] args) { var brainmessProcessor = new BrainmessInterpreter(); brainmessProcessor.Program = new BrainmessProgram { Instructions = "++++++++[>+++++++++<-]>.<+++++[>++++++<-]>-.+++++++..+++.<++++++++[>>++++<<-]>>.<<++++[>------<-]>.<++++[>++++++<-]>.+++.------.--------.>+." }; //brainmessProcessor.Program.Instructions = "+++>+++..[.-].."; //string program = "<<<<++++++++[>+++++++++<-]>."; brainmessProcessor.Execute(); Console.ReadLine(); }
public void TestExecute() { var brainmessProcessor = new BrainmessInterpreter { Program = new BrainmessProgram { Instructions = "><+-[]" } }; brainmessProcessor.Execute(); Assert.AreEqual(0, brainmessProcessor.TapeMemory.CurrentCellValue); }
public void TestExecuteCurrentInstruction() { var brainmessProcessor = new BrainmessInterpreter { Program = new BrainmessProgram { Instructions = ">" } }; brainmessProcessor.Execute(); Assert.AreEqual(1, brainmessProcessor.TapeMemory.CurrentPointer); }