using uCalcSoftware;

var uc = new uCalc();
// Internal Test: Verify error state is cleared
Console.WriteLine("--- Testing Error State Lifecycle ---");

// 1. Trigger a division-by-zero error.
uc.Error.TrapOnDivideByZero = true;
uc.EvalStr("1 / 0");
Console.WriteLine($"Message after 1/0: '{uc.Error.Message}'");
Console.WriteLine($"Error number is not None: {uc.Error.Code != ErrorCode.None}");

// 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.
Console.WriteLine($"Message after successful op: '{uc.Error.Message}'");
Console.WriteLine($"Error number is now None: {uc.Error.Code == ErrorCode.None}");