Internal Test: Verifies that the parent uCalc instance can be retrieved even from an empty Matches collection.
ID: 861
See: uCalc = [uCalc]
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
// NOTE: We do NOT call t.Find(), so the matches collection is empty.
var m = t.Matches;
Console.WriteLine($"Match count: {m.Count()}");
// Even with no matches, the parent context should be accessible
var parent_uc = m.uCalc;
Console.WriteLine($"Parent uCalc is valid: {parent_uc.MemoryIndex == uc.MemoryIndex}");
Match count: 0
Parent uCalc is valid: True using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); // NOTE: We do NOT call t.Find(), so the matches collection is empty. var m = t.Matches; Console.WriteLine($"Match count: {m.Count()}"); // Even with no matches, the parent context should be accessible var parent_uc = m.uCalc; Console.WriteLine($"Parent uCalc is valid: {parent_uc.MemoryIndex == uc.MemoryIndex}");
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
#define tf(IsTrue) ((IsTrue) ? "True" : "False")
int main() {
uCalc uc;
auto t = uc.NewTransformer();
// NOTE: We do NOT call t.Find(), so the matches collection is empty.
auto m = t.Matches();
cout << "Match count: " << m.Count() << endl;
// Even with no matches, the parent context should be accessible
auto parent_uc = m.uCalc();
cout << "Parent uCalc is valid: " << tf(parent_uc.MemoryIndex() == uc.MemoryIndex()) << endl;
}
Match count: 0
Parent uCalc is valid: 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.NewTransformer(); // NOTE: We do NOT call t.Find(), so the matches collection is empty. auto m = t.Matches(); cout << "Match count: " << m.Count() << endl; // Even with no matches, the parent context should be accessible auto parent_uc = m.uCalc(); cout << "Parent uCalc is valid: " << tf(parent_uc.MemoryIndex() == uc.MemoryIndex()) << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
'// NOTE: We do NOT call t.Find(), so the matches collection is empty.
Dim m = t.Matches
Console.WriteLine($"Match count: {m.Count()}")
'// Even with no matches, the parent context should be accessible
Dim parent_uc = m.uCalc
Console.WriteLine($"Parent uCalc is valid: {parent_uc.MemoryIndex = uc.MemoryIndex}")
End Sub
End Module
Match count: 0
Parent uCalc is valid: True Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() '// NOTE: We do NOT call t.Find(), so the matches collection is empty. Dim m = t.Matches Console.WriteLine($"Match count: {m.Count()}") '// Even with no matches, the parent context should be accessible Dim parent_uc = m.uCalc Console.WriteLine($"Parent uCalc is valid: {parent_uc.MemoryIndex = uc.MemoryIndex}") End Sub End Module