Internal Test: Verifies instance isolation by ensuring Tokens collections from different uCalc instances correctly resolve to their respective parents.

ID: 1050

				
					using uCalcSoftware;

var uc = new uCalc();
var uc1 = new uCalc();
var uc2 = new uCalc();

var t1 = new uCalc.Transformer(uc1);
var t2 = new uCalc.Transformer(uc2);

var tokens1 = t1.Tokens;
var tokens2 = t2.Tokens;

var parent1 = tokens1.uCalc;
var parent2 = tokens2.uCalc;

Console.WriteLine($"tokens1 belongs to uc1: {parent1.Handle() == uc1.Handle()}");
Console.WriteLine($"tokens2 belongs to uc2: {parent2.Handle() == uc2.Handle()}");
Console.WriteLine($"tokens1 does not belong to uc2: {parent1.Handle() != uc2.Handle()}");
				
			
tokens1 belongs to uc1: True
tokens2 belongs to uc2: True
tokens1 does not belong to uc2: True
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

#define tf(IsTrue) ((IsTrue) ? "True" : "False")

int main() {
   uCalc uc;
   uCalc uc1;
   uCalc uc2;

   uCalc::Transformer t1(uc1);
   uCalc::Transformer t2(uc2);

   auto tokens1 = t1.Tokens();
   auto tokens2 = t2.Tokens();

   auto parent1 = tokens1.uCalc();
   auto parent2 = tokens2.uCalc();

   cout << "tokens1 belongs to uc1: " << tf(parent1.Handle() == uc1.Handle()) << endl;
   cout << "tokens2 belongs to uc2: " << tf(parent2.Handle() == uc2.Handle()) << endl;
   cout << "tokens1 does not belong to uc2: " << tf(parent1.Handle() != uc2.Handle()) << endl;
}
				
			
tokens1 belongs to uc1: True
tokens2 belongs to uc2: True
tokens1 does not belong to uc2: True
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim uc1 As New uCalc()
      Dim uc2 As New uCalc()
      
      Dim t1 As New uCalc.Transformer(uc1)
      Dim t2 As New uCalc.Transformer(uc2)
      
      Dim tokens1 = t1.Tokens
      Dim tokens2 = t2.Tokens
      
      Dim parent1 = tokens1.uCalc
      Dim parent2 = tokens2.uCalc
      
      Console.WriteLine($"tokens1 belongs to uc1: {parent1.Handle() = uc1.Handle()}")
      Console.WriteLine($"tokens2 belongs to uc2: {parent2.Handle() = uc2.Handle()}")
      Console.WriteLine($"tokens1 does not belong to uc2: {parent1.Handle() <> uc2.Handle()}")
   End Sub
End Module
				
			
tokens1 belongs to uc1: True
tokens2 belongs to uc2: True
tokens1 does not belong to uc2: True