#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

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

int main() {
   uCalc uc;
   // Internal Test: Context integrity after cloning
   uCalc baseUc;
   baseUc.DefineVariable("x = 100");

   // Clone the base instance and modify the variable in the clone
   auto clonedUc = baseUc.Clone();
   clonedUc.Eval("x = 200");

   // Parse an expression in the original base context
   auto baseExpr = baseUc.Parse("x");

   // 1. Verify the expression evaluates using its original context's value
   cout << "Base expression evaluates to: " << baseExpr.Evaluate() << endl;

   // 2. Get the parent and verify it is not the cloned instance
   cout << "Parent is not the clone: " << tf(baseExpr.uCalc().MemoryIndex() != clonedUc.MemoryIndex()) << endl;
}