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

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // Trigger a syntax error
   uc.EvalStr("1 +");

   // Check the error state after the fact
   if (uc.Error().Code() != ErrorCode::None) {
      cout << "Error detected: " << uc.Error().Message() << endl;
   } else {
      cout << "Success!" << endl;
   }

   // Perform a successful operation, which clears the error state
   uc.EvalStr("1 + 1");
   if (uc.Error().Code() == ErrorCode::None) {
      cout << "Previous error was cleared by successful operation." << endl;
   }
}