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

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::Expression expr;

   // Implicitly parse an invalid expression. This sets an error state.
   expr = "5 * (10 +";

   // Implicit EvaluateStr should not throw but return the error message.
   cout << "Error Message: " << expr << endl;

   // Verify the error code is set.
   cout << "Error Code: " << (int)expr.uCalc().Error().Code() << endl;

   // Now, assign a valid expression.
   expr = "10 + 20";

   // The new assignment should clear the error state.
   cout << "Valid Result: " << expr << endl;
   cout << "Error Code after success: " << (int)expr.uCalc().Error().Code() << endl;
}