Internal Test: Verifies that releasing a rule correctly 'un-shadows' a previously defined rule with the same pattern.
ID: 975
See: Release
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
t.Text = "The quick brown fox.";
// 1. Define the original rule
var ruleV1 = t.FromTo("brown", "BROWN_V1");
Console.WriteLine($"Initial transform: {t.Transform()}");
// 2. Define a new rule with the same pattern, shadowing the original
t.Text = "The quick brown fox.";
var ruleV2 = t.FromTo("brown", "BROWN_V2");
Console.WriteLine($"After shadowing: {t.Transform()}");
// 3. Release the new rule. The original rule should become active again.
t.Text = "The quick brown fox.";
ruleV2.Release();
Console.WriteLine($"After release (reverted): {t.Transform()}");
Initial transform: The quick BROWN_V1 fox.
After shadowing: The quick BROWN_V2 fox.
After release (reverted): The quick BROWN_V1 fox. using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); t.Text = "The quick brown fox."; // 1. Define the original rule var ruleV1 = t.FromTo("brown", "BROWN_V1"); Console.WriteLine($"Initial transform: {t.Transform()}"); // 2. Define a new rule with the same pattern, shadowing the original t.Text = "The quick brown fox."; var ruleV2 = t.FromTo("brown", "BROWN_V2"); Console.WriteLine($"After shadowing: {t.Transform()}"); // 3. Release the new rule. The original rule should become active again. t.Text = "The quick brown fox."; ruleV2.Release(); Console.WriteLine($"After release (reverted): {t.Transform()}");
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
t.Text("The quick brown fox.");
// 1. Define the original rule
auto ruleV1 = t.FromTo("brown", "BROWN_V1");
cout << "Initial transform: " << t.Transform() << endl;
// 2. Define a new rule with the same pattern, shadowing the original
t.Text("The quick brown fox.");
auto ruleV2 = t.FromTo("brown", "BROWN_V2");
cout << "After shadowing: " << t.Transform() << endl;
// 3. Release the new rule. The original rule should become active again.
t.Text("The quick brown fox.");
ruleV2.Release();
cout << "After release (reverted): " << t.Transform() << endl;
}
Initial transform: The quick BROWN_V1 fox.
After shadowing: The quick BROWN_V2 fox.
After release (reverted): The quick BROWN_V1 fox. #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; t.Text("The quick brown fox."); // 1. Define the original rule auto ruleV1 = t.FromTo("brown", "BROWN_V1"); cout << "Initial transform: " << t.Transform() << endl; // 2. Define a new rule with the same pattern, shadowing the original t.Text("The quick brown fox."); auto ruleV2 = t.FromTo("brown", "BROWN_V2"); cout << "After shadowing: " << t.Transform() << endl; // 3. Release the new rule. The original rule should become active again. t.Text("The quick brown fox."); ruleV2.Release(); cout << "After release (reverted): " << t.Transform() << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
t.Text = "The quick brown fox."
'// 1. Define the original rule
Dim ruleV1 = t.FromTo("brown", "BROWN_V1")
Console.WriteLine($"Initial transform: {t.Transform()}")
'// 2. Define a new rule with the same pattern, shadowing the original
t.Text = "The quick brown fox."
Dim ruleV2 = t.FromTo("brown", "BROWN_V2")
Console.WriteLine($"After shadowing: {t.Transform()}")
'// 3. Release the new rule. The original rule should become active again.
t.Text = "The quick brown fox."
ruleV2.Release()
Console.WriteLine($"After release (reverted): {t.Transform()}")
End Sub
End Module
Initial transform: The quick BROWN_V1 fox.
After shadowing: The quick BROWN_V2 fox.
After release (reverted): The quick BROWN_V1 fox. Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() t.Text = "The quick brown fox." '// 1. Define the original rule Dim ruleV1 = t.FromTo("brown", "BROWN_V1") Console.WriteLine($"Initial transform: {t.Transform()}") '// 2. Define a new rule with the same pattern, shadowing the original t.Text = "The quick brown fox." Dim ruleV2 = t.FromTo("brown", "BROWN_V2") Console.WriteLine($"After shadowing: {t.Transform()}") '// 3. Release the new rule. The original rule should become active again. t.Text = "The quick brown fox." ruleV2.Release() Console.WriteLine($"After release (reverted): {t.Transform()}") End Sub End Module