public void IOLibraryTest() { var ioTestString = @" (0:0) when the script starts, (5:100) set variable %file to {test.txt}. (5:102) print {%file} to the console. (0:0) when the script starts, (1:200) and the file {%file} exist, (5:202) delete file {%file}. (5:203) create file {%file}. (0:0) when the script starts, (1:200) and the file {%file} exists, (1:203) and the file {%file} can be written to, (5:200) append {Hello World from Monkeyspeak!} to file {%file}. (0:0) when the script starts, (5:150) take variable %test and add 2 to it. (5:102) print {%test} to the console. "; Monkeyspeak.MonkeyspeakEngine engine = GetMonkeySpeakEngine(); Monkeyspeak.Page page = engine.LoadFromString(ioTestString); page.Error += DebugAllErrors; page.LoadSysLibrary(); page.LoadIOLibrary(); page.SetTriggerHandler(Monkeyspeak.TriggerCategory.Cause, 0, HandleAllCauses); page.Execute(0); }
public void TestLoadCompiledFile(string FileName) { Monkeyspeak.MonkeyspeakEngine engine = new Monkeyspeak.MonkeyspeakEngine(); engine.Options.TriggerLimit = int.MaxValue; Monkeyspeak.Page page = engine.LoadCompiledFile(FileName); page.LoadSysLibrary(); page.LoadIOLibrary(); page.LoadMathLibrary(); page.LoadTimerLibrary(); page.Execute(0); Console.WriteLine("Page Trigger Count: " + page.Size); }
public void GetTriggerDescriptionsTest() { Monkeyspeak.MonkeyspeakEngine engine = GetMonkeySpeakEngine(); Monkeyspeak.Page page = engine.LoadFromString(""); page.Error += DebugAllErrors; page.LoadSysLibrary(); page.LoadIOLibrary(); page.LoadMathLibrary(); page.LoadTimerLibrary(); foreach (string desc in page.GetTriggerDescriptions()) { Console.WriteLine(desc); } }