#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; #define tf(IsTrue) ((IsTrue) ? "True" : "False") int main() { uCalc uc; // Internal Test: Verify error state is cleared cout << "--- Testing Error State Lifecycle ---" << endl; // 1. Trigger a division-by-zero error. uc.Error().TrapOnDivideByZero(true); uc.EvalStr("1 / 0"); cout << "Message after 1/0: '" << uc.Error().Message() << "'" << endl; cout << "Error number is not None: " << tf(uc.Error().Code() != ErrorCode::None) << endl; // 2. Perform a successful operation, which should clear the previous error state. uc.EvalStr("1 + 1"); // 3. Verify the error message and number have been reset. cout << "Message after successful op: '" << uc.Error().Message() << "'" << endl; cout << "Error number is now None: " << tf(uc.Error().Code() == ErrorCode::None) << endl; }