public void Test_if_getter_setter_debug_functionCall_Instructions() { //Function that will be executed CorePackage.Entity.Function test = new CorePackage.Entity.Function(); //Variable used to check function validity CorePackage.Entity.Variable witness = new CorePackage.Entity.Variable(CorePackage.Entity.Type.Scalar.Integer, 42); //if (4 == 5) CorePackage.Execution.If f_cond = new CorePackage.Execution.If(); CorePackage.Execution.Operators.Equal condition = new CorePackage.Execution.Operators.Equal(CorePackage.Entity.Type.Scalar.Integer, CorePackage.Entity.Type.Scalar.Integer); condition.SetInputValue("LeftOperand", 4); condition.SetInputValue("RightOperand", 5); f_cond.GetInput("condition").LinkTo(condition, "result"); CorePackage.Entity.Function say_hello = new CorePackage.Entity.Function(); //print("Hello World !") CorePackage.Execution.Debug print_hello = new CorePackage.Execution.Debug(new CorePackage.Entity.Variable(CorePackage.Entity.Type.Scalar.String, "Hello World !")); print_hello.SetInputValue("to_print", "Hello"); //witness = 84 CorePackage.Execution.Setter true_change = new CorePackage.Execution.Setter(witness); true_change.SetInputValue("value", 84); print_hello.LinkTo(0, true_change); say_hello.setEntryPoint(say_hello.addInstruction(print_hello)); //If the condition is true, then do print_hello f_cond.Then(new CorePackage.Execution.FunctionCall(say_hello)); CorePackage.Entity.Function say_bye = new CorePackage.Entity.Function(); //print("Goodbye World !") CorePackage.Execution.Debug print_goodbye = new CorePackage.Execution.Debug(new CorePackage.Entity.Variable(CorePackage.Entity.Type.Scalar.String, "Goodbye World !")); //witness = 0 CorePackage.Execution.Setter false_change = new CorePackage.Execution.Setter(witness); false_change.SetInputValue("value", 0); print_goodbye.LinkTo(0, false_change); say_bye.setEntryPoint(say_bye.addInstruction(print_goodbye)); //Else, do print_goodbye f_cond.Else(new CorePackage.Execution.FunctionCall(say_bye)); //Set the function entry point before calling it test.setEntryPoint(test.addInstruction(f_cond)); //In this call, it will check that 4 is equal to 5, then it will execute print_goodbye and false_change test.Call(); //So the witness value is expected to be 0 if (witness.Value != 0) { throw new Exception("Failed: Witness have to be equal to 0"); } //To change the condition result, we will set the right operand of the operation to 4 condition.SetInputValue("RightOperand", 4); //Then, function call will check if 4 is equal to 4 in order to execute print_hello test.Call(); //So the witness value is exepected to be 84 if (witness.Value != 84) { throw new Exception("Failed: Witness have to be equal to 84"); } System.Diagnostics.Debug.Write(test.ToDotFile()); }