Internal Test: Verifies that multi-pass transformations work correctly when `RewindOnChange` is enabled for the entire rule set.
ID: 347
using uCalcSoftware;
var uc = new uCalc();
var t = uc.ExpressionTransformer;
// Enable RewindOnChange for all subsequently added rules
t.DefaultRuleSet.RewindOnChange = true;
// Define a chain of simple transformations
t.FromTo("A", "B");
t.FromTo("B", "C");
t.FromTo("C", "D");
// The transformer should apply all rules in sequence: A -> B -> C -> D
var result = t.Transform("A").Text;
Console.WriteLine($"Transform('A') -> {result}");
Console.WriteLine($"Is correct: {result == "D"}");
Transform('A') -> D
Is correct: True using uCalcSoftware; var uc = new uCalc(); var t = uc.ExpressionTransformer; // Enable RewindOnChange for all subsequently added rules t.DefaultRuleSet.RewindOnChange = true; // Define a chain of simple transformations t.FromTo("A", "B"); t.FromTo("B", "C"); t.FromTo("C", "D"); // The transformer should apply all rules in sequence: A -> B -> C -> D var result = t.Transform("A").Text; Console.WriteLine($"Transform('A') -> {result}"); Console.WriteLine($"Is correct: {result == "D"}");
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
#define tf(IsTrue) ((IsTrue) ? "True" : "False")
int main() {
uCalc uc;
auto t = uc.ExpressionTransformer();
// Enable RewindOnChange for all subsequently added rules
t.DefaultRuleSet().RewindOnChange(true);
// Define a chain of simple transformations
t.FromTo("A", "B");
t.FromTo("B", "C");
t.FromTo("C", "D");
// The transformer should apply all rules in sequence: A -> B -> C -> D
auto result = t.Transform("A").Text();
cout << "Transform('A') -> " << result << endl;
cout << "Is correct: " << tf(result == "D") << endl;
}
Transform('A') -> D
Is correct: True #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; #define tf(IsTrue) ((IsTrue) ? "True" : "False") int main() { uCalc uc; auto t = uc.ExpressionTransformer(); // Enable RewindOnChange for all subsequently added rules t.DefaultRuleSet().RewindOnChange(true); // Define a chain of simple transformations t.FromTo("A", "B"); t.FromTo("B", "C"); t.FromTo("C", "D"); // The transformer should apply all rules in sequence: A -> B -> C -> D auto result = t.Transform("A").Text(); cout << "Transform('A') -> " << result << endl; cout << "Is correct: " << tf(result == "D") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.ExpressionTransformer
'// Enable RewindOnChange for all subsequently added rules
t.DefaultRuleSet.RewindOnChange = true
'// Define a chain of simple transformations
t.FromTo("A", "B")
t.FromTo("B", "C")
t.FromTo("C", "D")
'// The transformer should apply all rules in sequence: A -> B -> C -> D
Dim result = t.Transform("A").Text
Console.WriteLine($"Transform('A') -> {result}")
Console.WriteLine($"Is correct: {result = "D"}")
End Sub
End Module
Transform('A') -> D
Is correct: True Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.ExpressionTransformer '// Enable RewindOnChange for all subsequently added rules t.DefaultRuleSet.RewindOnChange = true '// Define a chain of simple transformations t.FromTo("A", "B") t.FromTo("B", "C") t.FromTo("C", "D") '// The transformer should apply all rules in sequence: A -> B -> C -> D Dim result = t.Transform("A").Text Console.WriteLine($"Transform('A') -> {result}") Console.WriteLine($"Is correct: {result = "D"}") End Sub End Module